Thread: Cannot call properly?

  1. #1
    Registered User
    Join Date
    Mar 2011

    Cannot call properly?

    I am working on this basic c program for a class I am taking. We are having trouble getting to call the CalculateHourlyWage at the end of the program. We want it to display an employees hourly wage and print it on the screen. I do not have to much experience in C, so any help you guys can provide me with would be great!

    /* This is a C program to printout the hourly wage */
    /* given a yearly salary and hours worked per month */
    float CalculateMonthlySalary (float, float);
    float CalculateHourlyWage (float, float);
     int YearlySalary;
     int HoursWorkedPerMonth;
     float MonthlySalary;
     float HourlyWage;
     float x, y, z;
     /* Define the Yearly Salary */
     /* Define the Hours Worked Per Month */
     /* call function product using arguments  */
     printf("** Hourly Wage is $%5.0f ** \n", HourlyWage);
    /* Two functions are defined as follows */
    /* (1) Formula of the calculation of the monthly salary */
     float CalculateMonthlySalary (float x, float y)
     float Salary;
     Salary = (x/y);
    /* (2) Formula of the calculation of the hourly wage */
     float CalculateHourlyWage (float MonthlySalary, float z)
     float Wage;
     Wage = (MonthlySalary/z);
    /* END of the program */

  2. #2

  3. #3
    Join Date
    Aug 2010
    Ontario Canada
    It might also help if you actually called the functions....

  4. #4
    Registered User
    Join Date
    Mar 2010
    Are you having a specific problem with it? Or do you just not know where to go from here?

    You can print the hourly wage by calling CalculateMonthlySalary() and CalculateHourlyWage() inside the printf. I guess that's what you're trying to work out how to do?

    Start simple -- just call the functions and store the results to the variables you already have. Then you can cram it all into printf later, if you wish.

    Function call would look like this:
    MonthlySalary = CalculateMonthlySalary(x, y);
    and similar for CalculateHourlyWage().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Call external C programs and receive data
    By ferenczi in forum C Programming
    Replies: 11
    Last Post: 02-12-2008, 12:32 PM
  2. Multiple types in lists, vectors or arrays.
    By megatron09 in forum C++ Programming
    Replies: 20
    Last Post: 08-31-2006, 01:54 PM
  3. Assembly example
    By Lynux-Penguin in forum C Programming
    Replies: 6
    Last Post: 04-24-2002, 07:45 PM
  4. Help needed with external call, WinExec() and timer.
    By algorithm in forum Windows Programming
    Replies: 9
    Last Post: 11-07-2001, 09:35 AM
  5. Pls help me to do this project in C I need source code
    By sureshmenon74 in forum C Programming
    Replies: 4
    Last Post: 10-04-2001, 06:57 AM