Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8903265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:49:34+00:00 2026-06-15T01:49:34+00:00

The function gets an integer and a digit, and should return true if the

  • 0

The function gets an integer and a digit, and should return true
if the digit appears an even number of times in the integer, or false if not.

For example:

If digit=1 and num=1125
the function should return true.

If digit=1 and num=1234
the function should return false.

bool isEven(int num, int dig)
{
    bool even;

    if (num < 10)
        even = false;
    else
    {
        even = isEven(num/10,dig);

This is what I’ve got so far, and I’m stuck…
This is homework so please don’t write the answer but hint me and help me get to it by myself.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:49:35+00:00Added an answer on June 15, 2026 at 1:49 am

    To set up recursion, you need to figure out two things:

    1. The base case. What is are the easy cases that you can handle outright? For example, can you handle single-digit numbers easily?
    2. The rule(s) that reduce all other cases towards the base case. For example, can you chop off the last digit and somehow transform the solution for the remaning partial number into the solution for the full number?

    I can see from your code that you’ve made some progress on both of these points. However, both are incomplete. For one thing, you are never using the target digit in your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a function which gets an encoded string (possibly UTF-16 not sure)
I have a java code which gets the function names, their return types, their
I'm writing an utility function that gets a integer from the database and returns
Calling the setTimeout function will return an integer ID so that clearTimeout can be
I'm trying to write a small function that gets an id u (integer), and
I have a simple function about neural network. This function gets a matrix, loads
I am trying to call terminate function. [I think this function gets called when
I am working on a code which requires a function. This function gets a
I'm using C++ map to implemented a dictionary in my program. My function gets
In my Java code I have function that gets file from the client in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.