nid help on programming a calculator! anyone can help pls...

This is a discussion on nid help on programming a calculator! anyone can help pls... within the C Programming forums, part of the General Programming Boards category; when i run my calculator, 2 error pops out. The first one says" get_input function does not take three argument". ...

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    10

    nid help on programming a calculator! anyone can help pls...

    when i run my calculator, 2 error pops out. The first one says" get_input function does not take three argument". The second one sounds like "Intellisense : too few argument in function calls". May i know what the problem behind these error and how to solve it? thx alot.

    Code:
    #include <stdio.h>
    #include <math.h>
    #include <stdlib.h>
    #include <ctype.h>
     
     
    /* global function that you can use to avoid copy/pasted code */
    void get_input(double *frequency_factor, double *rate_constant, double *activation_energy, double *temperature )
    {
        printf("Please key in frequency_factor");
        scanf("%lf",frequency_factor);
        printf("Please key in rate constant");
        scanf("%lf", rate_constant);
        printf("Please key in actvation_energy");
        scanf("%lf", activation_energy);
        printf("Please key in temperature");
        scanf("%lf", temperature);
    }
     
     
    int main (void)
    {
        char letter, tmp;
        double rate_constant, frequency_factor, activation_energy, temperature;
         
        puts("This is an Arrhenius Equation calculator\n"
               "k=Ae^(-Ea/RT)\n"
               "A=frequency_factor\n"
               "k=rate_constant\n"
               "Ea=activation_energy\n"
               "R=8.314*10^-3 kJ/mol*k\n"
               "T=temperature\n\n");
     
     
        puts("what do you want to find?\n\n"
             "A)frequency_factor\n"
             "B)rate_constant\n"
             "C)activation_energy\n"
             "D)temperature\n\n");
         
        /* new call here, just for organization's sake. */
         
        tmp = getchar(); 
        getchar(); 
        letter = toupper(tmp); 
     
     
        if (letter=='A') {  
            get_input(&rate_constant, &activation_energy, &temperature);
            frequency_factor=(rate_constant)/pow(2.72,((-activation_energy)/(0.008314)*(temperature)));
            printf("the frequency_factor calculated is %.3f,\n",frequency_factor);
        }
        else if (letter=='B') {
            get_input(&frequency_factor, &activation_energy, &temperature);
            rate_constant=(frequency_factor)*(pow(2.72,(-activation_energy)/(0.008314)*(temperature)));
            printf("the rate_constant calculated is %.3f,\n",rate_constant);
        }
        else if (letter=='C') {
            get_input(&frequency_factor, &rate_constant, &temperature);
            activation_energy=(-0.008314)*(temperature)*(log(rate_constant)/(frequency_factor));
            printf("the activation_energy calculated is %.3f,\n",activation_energy);
        }
        else if (letter=='D') {
            get_input(&frequency_factor, &rate_constant, &activation_energy);
            temperature=(-activation_energy)/((0.00831)*(log(rate_constant)/(frequency_factor)));
            printf("the temperature calculated is %.3f,\n",temperature);
        }
        else 
            printf("You entered the wrong input. Please key in alphabet from A to D only. Thank you !");
        
    }

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    get_input lists four parameters, but your call to the function, is only passing it three parameters.

    If you can abbreviate your code line length, so it doesn't run off the standard page length, it will be a LOT easier to read it. Normally, I skip these completely, because they're a real PITA.

    You do have a great indentation style - congrats!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. programming a chemistry calculator. Need help !
    By ivanleong in forum C Programming
    Replies: 5
    Last Post: 02-25-2012, 06:48 PM
  2. Replies: 3
    Last Post: 08-17-2009, 08:25 AM
  3. C++ Calculator Help
    By cjwenigma in forum C++ Programming
    Replies: 2
    Last Post: 04-25-2007, 11:35 AM
  4. GTK+: calculator
    By conghaile in forum C Programming
    Replies: 2
    Last Post: 04-28-2005, 09:13 AM
  5. C++ Programming - stack based calculator program
    By tinkerbelle in forum C++ Programming
    Replies: 9
    Last Post: 10-13-2003, 03:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21