Hello! I am trying to write a weird program for a carwash, and keep getting this error: In function `int super_loop(int, int)': error: too few arguments to function `double super_calculate(char, int, int)' error:174 at this point in file Can somebody tell me why? I know the code shouldn't be in C and C++, but that was the instruction. Is that interfering with the compilation? Code: #include <cstdio> //Header Files #include <iostream> #include <cmath> using namespace std; int display_function (); void big_switch(int, int); int random; static float grandtotal; void quit_pattern(); int init_function(); int display_function(); int grand_total(); void calculate (int, int); void calculate (int); int super_loop(int passengers, int age); double super_calculate(char passgend, int passage, int age); int main(){ int age, choose; //Initializing variables bool notValid; init_function(); grandtotal=init_function(); while(true){ choose=display_function(); do{ //Validation for age notValid=false; printf ("\nHow old are you?"); cin >> age; if (age<1 || age>115){ cout << "Invalid entry.\n"; notValid=true; } }while (notValid); big_switch(choose, age); } } void big_switch(int choose, int age){ switch(choose){ case 1: int passengers; cout << "\nHow many passengers do you have?"; cin >> passengers; calculate(passengers, age); break; case 2: calculate(age); break; case 3: bool notValid; do{ notValid=false; //Validating for >4 passengers cout << "\nHow many passengers do you have?"; cin >> passengers; if (passengers >=4){ cout << "Invalid entry."; notValid=true; } }while (notValid); super_loop(passengers, age); break; case 4: quit_pattern(); break; default: cout << "Invalid entry\n\n"; } } void calculate (int passengers, int age){ int a; double fee; if (passengers>3){ fee=passengers*age; grandtotal=grandtotal+fee; //Calculating price for #1 printf ("%30s","The price for you is $"); printf ("%-5.2lf", fee); cout << "\n\n"; printf ("%30s","The grand total is $"); printf ("%-5.2lf\n", grandtotal); } else for(a=0;a<passengers;a++){ //Display as many starts as the number of passengers cout << "*\n"; grandtotal=grandtotal+fee; printf ("%30s","The price for you is $"); printf ("%-5.2lf", fee); cout << "\n\n"; printf ("%30s","The grand total is $"); printf ("%-5.2lf""\n", grandtotal); } } void calculate(int age){ double fee; //Calculating price for #2 if (age>=65){ fee=(age-65)*.5; printf ("%30s","The price for you is $"); printf ("%-5.2lf", fee); cout << "\n\n"; } else if(age% 2 == 0) cout << "\nNo Charge\n\n\n"; else{ fee=age; grandtotal=grandtotal+fee; printf ("%30s","The price for you is $"); printf ("%-5.2lf", fee); printf ("%30s","The grand total is $"); printf ("%-5.2lf\n", grandtotal); cout << "\n\n"; } grandtotal=grandtotal+fee; } int super_loop(int passengers, int age){ int a, passage; double fee, grandtotal; char passgend; bool notValid; for (a=1;a<passengers;a++){ do{ //Loop for passengers' ages and genders notValid=false; cout << "\nEnter gender of passenger number "; cout << a; cin >> passgend; if (passgend!='m' && passgend!='f'){ cout << "Invalid entry.\n"; notValid=true; } }while (notValid); cout << "\nEnter age of passenger number "; cout << a <<":"; cin >> passage; } fee = super_calculate(); grandtotal=grand_total(); grandtotal=grandtotal+fee; printf ("%30s","The price for you is $"); printf ("%-5.2lf", fee); printf ("%30s","The grand total is $"); printf ("%-5.2lf\n", grandtotal); cout << "\n\n"; } double super_calculate(char passgend, int passage, int age){ double fee; if (passgend=='f'){ //Calculating for f passenger fee=passage*1.5; return(fee); } else //Calculating for f passenger fee=2*age; return(fee); } int inline init_function(){ int rand_number = rand()%100+10; return(rand_number); } int grand_total(int, int){ int fee, rand_number; cout << rand_number; rand_number=init_function(); double grandtotal=fee+rand_number; cout << "The grand total is :" << grandtotal; } int display_function (){ int selection; cout << "Welcome to the Fair Price Car Wash\n\n"; cout << "1) Regular Car Wash\n"; cout << "2) Super Car Wash\n"; cout << "3) SuperDooper Car Wash\n"; cout << "4) Quit\n\n\n"; cout << "Select one of the options:"; cin >> selection; return (selection); } void quit_pattern(){ int row, space, asterisk; for(row=1; row<5; row++) { for(space=0; space>4+row; space++) printf (" "); for(asterisk=1; asterisk<=2*row; asterisk++) //Displaying stars printf("*"); cout << endl; } }
Your call to the function is parameter less fee = super_calculate(); but the function needs the paramters double super_calculate(char passgend, int passage, int age);