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.
Code:
#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)
{
greet_user();
get_initial_cost();
get_fuel();
get_tax();
calculate_cost();
give_results();
return (0);
}
void greet_user(void)
{
printf("This program will calculate the cost of your house after");
printf(" owning it for 5 years.");
return;
}
double get_initial_cost(void)
{
double initial;
printf("Please enter in the initial cost of your house:/n");
scanf("%lf", &initial);
return(initial);
}
double get_fuel(void)
{
double fuel;
printf("Please enter in your annual fuel cost:/n");
scanf("%lf", &fuel);
return(fuel);
}
double get_tax(void)
{
double tax;
printf("Please enter in your tax rate:/n");
scanf("%lf", &tax);
return(tax);
}
double calculate_cost(double initial, double fuel, double tax)
{
double cost;
cost = (initial + fuel + tax) * 5.0;
return(cost);
}
void give_results(double cost)
{
printf("The total cost of your house after owning it for");
printf(" five years is %f",cost);
return;
}
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!