parameter passing - C++ Error C2660: Function does not take 3 arguments -
i'm racking brain figure out.. know simple need new set of eyes figure out i'm missing?
line contains ** below, 7th line bottom
i'm getting error c2660: 'drilloneproblem' : function not take 3 arguments. please!
// drill problem void drilloneproblem() { int c, r1, r2; // passed-in parameters int corans; // correct answer int reply; // user's answer // ask first part of question , display first random number cout << "\nwhat " << r1; // display sign based on user's answer switch (c) { case '1': cout << " + "; corans = r1 + r2; break; case '2': cout << " - "; corans = r1 - r2; break; case '3': cout << " * "; corans = r1 * r2; break; } // finish question , display second random number // ask answer, validate answer , display message cout << r2 << " ? "; cin >> reply; if (reply == corans) { cout << "yes, corret. job!"; } else cout << "no, correct answer is: " << corans << endl << endl; } int main() { int c; // user's menu choice int r1, r2; // random numbers //display menu displaymenu(); // user's choice , validate if out of range c = getmenuchoice(); // continue program if user doesn't quit while (c >= 1 && c < sent) { // generate random numbers gen2rand(r1, r2); // display question based on user's menu choice request answer , validate answer. // display message show if correct or not correct. if not correct display correct answer **drilloneproblem(c, r1, r2);** // display menu again , ask menu choice after problem has been processed, repeat until user quits displaymenu(); c = getmenuchoice(); } return 0; }
parameters need declared in brackets in function declaration.
so this:
void drilloneproblem() { int c, r1, r2; // passed-in parameters
should this:
void drilloneproblem(int c, int r1, int r2) {
Comments
Post a Comment