Question
I need some help running this code. I can't get it to run. #include #include using namespace std; int getNumber(); string determineEvenOrOdd(int); string determinePositiveOrNegative(int); void
I need some help running this code. I can't get it to run.
#include
int main(void) { int Number = 0; string EvenOrOdd; string PositiveOrNegative; char repeat; Number = getNumber(); EvenOrOdd = determineEvenOrOdd(Number); PositiveOrNegative = determinePositiveOrNegative(Number); displayResults(Number, EvenOrOdd, PositiveOrNegative); cout << endl << endl; return 0; }
int getNumber() {
do { int Number; cout << "Please enter the number to be determined as even/odd or positive/negative: "; cin >> Number;
if (Number < -10000 || Number> 10000) cout << "The Number is Invalid "; return Number; } while if (Number < -10000 || Number> 10000)
}
string determineEvenOrOdd(int Number) { string EvenOrOdd;
if (Number % 2 = 0) EvenOrOdd = " Even"; else EvenOrOdd = "Odd"; return EvenOrOdd; } string determinePositiveOrNegative(int) { if (Number > 0) PositiveOrNegative = "Positive"; else PositiveOrNegative = "Negative"; return PositiveOrNegative;
} void displayResults(int, string, string) { cout << "The number you entered, " << Number << "is a" << PositiveOrNegative << "," << EvenOrOdd << "Value." << endl; cout << "Would you like to calculate the stats on another team? Y or N)"; cin >> repeat;
}while (repeat == 'Y' || repeat == 'y'); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started