CFanatic

Go Back   CFanatic > Programming > C Programming

Join CFanatic Forum Now

Too Few Arguments Error topic posted under C Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 10-01-2007, 08:49 PM
Junior Member
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
veronicak5678 is on a distinguished road
| More
Too Few Arguments Error

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;
              }
}
Reply With Quote
  #2  
Old 10-02-2007, 01:06 AM
shabbir's Avatar
Administrator
 
Join Date: Sep 2006
Posts: 1,224
Thanks: 78
Thanked 70 Times in 48 Posts
shabbir has a spectacular aura aboutshabbir has a spectacular aura about
| More
Re: Too Few Arguments Error

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);
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
a function that takes 3 command-line arguments new4c C Programming 3 12-29-2008 01:14 AM
Logic Error dlsparks C# Programming 5 09-22-2007 11:55 PM
how to pass the arguments to procedure to close the window vidhya Win32 Programming 0 05-30-2007 05:24 AM
how to store the command line arguments which are passed in previous execution vidhya Win32 Programming 2 05-24-2007 01:28 AM
segmented error?? rati C Programming 5 09-12-2006 09:23 AM



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.