Thread: keep getting error C2064: term does not evaluate to a function taking 1 arguments

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    16

    keep getting error C2064: term does not evaluate to a function taking 1 arguments

    Can someone tell me what this means? I keep getting this error on a couple lines. (Will bold to let you know which ones) I would really appreciate it. Thanks!
    error C2064: term does not evaluate to a function taking 1 arguments
    Code:
    #include <stdio.h>			
    #include <stdlib.h>			
    #include <conio.h>						
    #include <string.h>			
    #include <ctype.h>	
    #include <time.h>
    double NohalfDollars;
    double Noquarters;
    double Nodimes;
    double Nonickels;
    double Nopennies;
    #define half .50
    #define quarter .25
    #define dime .10
    #define nickle .05
    #define penny .01
    #define MAX 5
    
    void display_menu();			
    char get_choice();			
    
    void option_A();			
    void option_B();			
    
    
    void main()					
    {							
      char choice;				
    	do						
    	{							
    	  display_menu();				
    	  choice = get_choice();	
    								
    	  switch(choice)			
    	  {							
    	   case 'A':					
            option_A();				
    		break;					
           case 'B':				
    		option_B();				
    		break;					
          }							
    	} while(choice != 'C');		
    }								
    
    void display_menu()				
    {								
     system("cls");					
    								
     printf("\n~~Select one of the following options~~\n\n"); 
     printf("A-------Option A-The Magic Number!\n");			
     printf("B-------Option B-Counting Change!\n");			
     printf("C-------Quit\n");			
    }									
    						
    char get_choice()				
    {								
     char ch;						
     do								
     {								
      ch = toupper(_getch());		
    							
     } while (!strchr("ABC",ch));	
    						
    								
     return ch;						
    }								
    
    
    
    void option_A()		
    
    {
     int magic,               
         guess,               
         tries = 0;           
    
     srand( (unsigned)time( NULL ) ); 
     magic = rand()%MAX;              
     system("cls");
    
     printf("\n\nGuess the random number from 0 to %d\n\n",MAX);
     do
     {
    	printf("guess: ");
    	scanf_s("%d",&guess);
    	if(guess == magic)
    	{
    	 printf("** Right **");
    	 printf("%d is the magic number\n", magic);
    	}
    	else
    	if (guess > magic)
    	 printf(".. Wrong .. Too High\n");
    	else
    	 printf(".. Wrong .. Too Low\n");
    	tries++;
     } while(guess != magic);
    
     printf("You took %d tries.\n", tries);
     printf("\n\n\n\nPress any key to return to the main menu!"); 
     _getch();
    }
    						
    
    void option_B()					
    						
    
    
    {	int Nickels=0;
    	int Half=0; 
    	int Quarters=0;
    	int Dimes=0;
    	int Pennies=0;
    	int Total =0;
    	double sum =0;
    	
    	
        printf("Enter pennies amount: \n");
    	scanf_s("%d",&Pennies);
    	printf("Enter quarters amount: \n");
    	scanf_s("%d",&Quarters);
    	printf("Enter dimes amount: \n");
    	scanf_s("%d",&Dimes);
    	printf("Enter nickels amount: \n");
    	scanf_s("%d",&Nickels);
    	printf("Enter half dollar amount: \n");
        scanf_s("%d",&Half);
    
    	printf ("You have entered %d Half Dollars for: $%.2f ",Half,NohalfDollars(Half));
    	printf ("\nYou have entered %d Quarters for: $%.2f ",Quarters,Noquarters(Quarters));
    	printf ("\nYou have entered %d Dimes for: $%.2f ",Dimes,Nodimes(Dimes));
    	printf ("\nYou have entered %d Nickles for: $%.2f ",Nickels,Nonickels(Nickels));
    	printf ("\nYou have entered %d Pennies for: $%.2f ",Pennies,Nopennies(Pennies));
    	Total=Half+Quarters+Dimes+Nickels+Pennies;
    	
         
    
    	sum=NohalfDollars(Half)+Noquarters(Quarters)+Nodimes(Dimes)+Nonickels(Nickels)+Nopennies(Pennies);
    	printf ("\nYou have entered %d coins worth a total of : $%.2f ",Total,sum);
    	printf ("\n\n\nPress Any Key to Return to the Main Menu ..... ");
    	_getch();
    
    	
       
    }

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Well it's pretty clear, innit? NohalfDollars is so not a function, but just a variable. C doesn't do implicit multiplication, like 5x doesn't mean 5 * x; you need to put the * in there yourself.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    16
    ok i get that. i fixed it by multiplying it using the *. But when i run it, it prompts me for pennies(the first prompt) but then it doesn't prompt me for the quarters, dimes, etc and automatically sums it up. Do you know why it wouldn't be prompting me for the others?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    If you type a letter, or even a decimal point, then that's the end of input -- %d won't read anything for a letter or a decimal point.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    16
    ohh i see. thanks a lot for the help. I was typing it with a decimal. Makes perfect sense now. Thanks so much!! I really appreciate it!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 10-20-2008, 10:23 AM
  2. Problem Displaying a Struct
    By rockstarpirate in forum C++ Programming
    Replies: 16
    Last Post: 05-05-2008, 09:05 AM
  3. recursion error
    By cchallenged in forum C Programming
    Replies: 2
    Last Post: 12-18-2006, 09:15 AM
  4. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  5. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 08:55 AM