Thread: First time programmer need a little help

  1. #1
    Registered User
    Join Date
    Feb 2009

    First time programmer need a little help

    So I am pretty new to programming as I am a freshman in college. I have written out my program for the assignment this week and I just can't for the life of me figure out how to get rid of theses errors.

    #include <stdio.h>
    void greet_user(void);
    double get_initial_cost(void);
    double get_fuel(void);
    double get_tax(void);
    double calculate_cost(double initial, double fuel, double tax)
    void give_results(double calculate)
    int main (void)
      return (0);
    void greet_user(void)
      printf("This program will calculate the cost of your house after");
      printf(" owning it for 5 years.");
    double get_initial_cost(void)
      double initial;
      printf("Please enter in the initial cost of your house:/n");
      scanf("%lf", &initial);
    double get_fuel(void)
      double fuel;
      printf("Please enter in your annual fuel cost:/n");
      scanf("%lf", &fuel);
    double get_tax(void)
      double tax;
      printf("Please enter in your tax rate:/n");
      scanf("%lf", &tax);
    double calculate_cost(double initial, double fuel, double tax)
      double cost;
      cost = (initial + fuel + tax) * 5.0;
    void give_results(double cost)
      printf("The total cost of your house after owning it for");
      printf(" five years is %f",cost);
    I get these errors:

    In function 'calculate_cost':
    10: error: parse error before "int"
    13: error: old-style parameter declarations in prototyped function definition
    at top level:
    54: error: redefinition of 'calculate_cost'
    13: error: previous definition of 'calculate_cost' was here

    I know these are some dumb errors, but I have been trying to get rid of them for the past couple of hours and nothing seems to work.

    Any help is greatly appreciated!

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault
    Did you try adding ; to the end of lines 7 and 8? The other errors you are having probably cascade from this.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 07-05-2010, 10:43 AM
  2. Help with assignment!
    By RVDFan85 in forum C++ Programming
    Replies: 12
    Last Post: 12-03-2006, 12:46 AM
  3. Is this really true or it's just science fiction?
    By Nutshell in forum A Brief History of
    Replies: 145
    Last Post: 04-09-2002, 06:17 PM
  4. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM