Thread: too few actual parametrs

  1. #1
    grunt161
    Guest

    Unhappy too few actual parametrs

    i am making a calulator i know it dont work yet, but i get too few actual parameters when i include calc.h

    here is what is in the c file:

    Code:
    /******************************************
    Program: Name: Area Calculator
    Purpose: Calculates the area of various geomatrical shapes
    Input:	 Keyboard
    Output:	 Screen
    *******************************************/
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    #include "calc.h"
    
    
    int main()
    {
    	int answer;
    	int menu_choice; //menu variable
    	double input_data1 = 0; //set data1 to zero
    	double input_data2 = 0; //set data2 to zero
    	
    
    			printf("\n	Welcome To My Calculator		  \n");
    			printf("******************************************\n"); 
    			printf("Data 1: %lf\n", & input_data1);                   
    			printf("Data 2: %lf\n");                                
    			printf("Operator:%c\n");
    			printf("Result:%lf\n", &answer);									//Calling Main results in recursion..
    			printf("******************************************\n");
    	
    			printf("Main Menu (Choose One)\n");
    			printf("  1: Input Data 1\n");
    			printf("  2: Input Data 2\n");	
    			printf("  3: Set Operator +\n");
    			printf("  4: Set Operator -\n");
    			printf("  5: Set Operator *\n");
    			printf("  6: Set Operator /\n");
    			printf("  7: Set Operator %\n");
    			printf("  8: Set Operator pow\n");
    			printf("  9: Set Operator exp\n");
    			printf("  10: Set Operator sqrt\n");
    			printf("  11: Set Operator sin\n");
    			printf("  12: Quit\n");
    
    			printf("Please Choose one: ");
    			scanf("%d", & menu_choice);
    		
    		switch (menu_choice)
    			{
    		
    		case 1 :	
    			printf("Enter Data 1: ");
    			scanf("%lf", &input_data1);
    				 
    		case 2 :	
    			printf("Enter Data 2: ");
    			scanf("%lf", &input_data2);
    				
    		case 3 :	
    			calcadd(); //if the user chooses 3, run the calcadd function
    					
    		default :
    			printf("Invalid Menu Choice\n"); //if the user pics an invalid choice for the menu
    			}
    return 0;
    }
    
    /******************************************
    Function Name: calcadd()
    Purpose: Calculates the area of a square
    *******************************************/
    
    int calcadd(int input_data1, int input_data2, int answer)
    
    {
    	printf("Adding %lf, and %lf...", input_data1, input_data2);
    	answer = input_data1 + input_data2; //data1 plus data2 equals answer	
    
    return 0;
    }
    here is what i have in the header file:
    Code:
    //Header file for calc.h
    
    int calcadd(int input_data1, int input_data2, int answer); //calcadd prototype
    i am only getting the adding functio working 1st. then iw ill do the rest of the functions.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >int calcadd(int input_data1, int input_data2, int answer)
    This is your declaration, calcadd takes three ints as arguments.

    >calcadd();
    This is how you call calcadd. It's missing the three int arguments and your compiler is complaining about it.

    -Prelude
    My best code is written with the delete key.

  3. #3
    Unregistered
    Guest
    thanks that did it.

  4. #4
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    522
    When you are writing the skeleton of your program and you haven't coded all of your functions a good idea is to declare them void like
    Code:
     
    void calcadd(void)
    and just have them print there own name. That way the program will compile and you will know if functions are being called when they're supposed to be and you can add code and test a bit at a time rather than write loads of code and find it don't work.
    All spelling mistakes, syntatical errors and stupid comments are intentional.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 14
    Last Post: 07-14-2009, 08:16 AM
  2. Lists (sorting)
    By ultimo12345 in forum C Programming
    Replies: 2
    Last Post: 11-10-2008, 11:43 PM
  3. Replies: 6
    Last Post: 01-08-2008, 10:25 AM
  4. Question - GUIs and Actual Program Design
    By Enoctis in forum C++ Programming
    Replies: 10
    Last Post: 10-03-2005, 08:51 PM
  5. stdio.h - where is actual code
    By voltson4 in forum C Programming
    Replies: 0
    Last Post: 02-26-2003, 05:11 PM