May 7th, 2013, 04:13 PM
Need help pointing out where/if these are applied:
Private/protected data members/functions
Functions, parameters, return values
using namespace std;
int randomNumber(int max)
return (rand() % max + 1); // random number between 1 and 100
cout << "\tWelcome to Guess My Number\n\n";
cout << "Enter a guess: ";
cin >> guess;
if (guess > secretNumber)
cout << "Too high!\n\n";
else if (guess < secretNumber)
cout << "Too low!\n\n";
cout << "\nThat's it! You got it in " << tries << "guesses!\n";
} while (guess != secretNumber);
May 7th, 2013, 04:25 PM
Re: code problem
What have you got so far?
May 7th, 2013, 04:33 PM
Re: code problem
Constructor overloading is where several class constructors are defined that take different type/number parameters. In the code the class is RandomNumberGenerator, so what are the class constructors and how many constructors are there?
In a class, by default all entries are private (unlike a struct where all are public). So in a class unless a member is specified as public or protected, they are private. So for the class, which are the private, public and protected members?
A function can have none or multiple parameters. It can also return a value or not. If the function doesn't return a value then void is used for the return type. So what are the functions, their parameters and return types?
Sorry, but as this is homework we won't provide you with the answers directly, but give you some guidance. You may like to look at
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on.
C, C++ Compiler: Microsoft VS2017
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!