I have been tasked with an assignment for "oddball questions". Basically it is a case-switch statement that should handle several different situations.
The assignment is very simple, and I will post the full assignment as an attachment. However, (from my TA):
Your program must have the following functions:
a getName function which will input the name of the Geek
an isEven function that takes two integers and returns a boolean value indicating if the sum of the numbers is even or not
a sum function that takes two integers and computes and returns an int which is the sum of all numbers between the two inclusive (include the numbers in the sum) – for full credit this method should work even if the two numbers are the same (the sum is just one of the numbers) or if the first number is larger than the second. Also, you cannot assume which number will be greater.
a isLeapYear function that takes an integer and returns a boolean value indicating if the number is a leap year. A leap year is one with 366 days. A year is a leap year if it is divisible by 4 (for example, 1980), and if it is not divisible by 100 (for example 1900); however, it is a leap year if it is divisible by 400 (for example, 2000).
a display function which will display the geeks name and the number of questions that have been asked so far. This question is not included in calculating the number of questions asked so far.
The four functions should have the following prototypes:
string getName(int & countQuestions);
boolean isEven(int firstNumber, int secondNumber, int & countQuestions);
integer isEven(int firstNumber, int secondNumber, int & countQuestions);
boolean isLeapYear(int year, int & countQuestions);
void display(string name, int countQuestions);
The program will ask a user to enter one of the following commands. Based on the user's choice, the program needs to perform corresponding operation. The program will terminate when the user enters 'q'.
Now, I don't think that the function prototypes are possible as they differ only from the type of return.
When following my assignment sheet, I receive many errors from visual C++ regarding the fact that the two prototypes differ only by the type of return.
Any insight would be greatly appreciated.
q.