Im writing a code to calculate the cost for parking in a parking lot based on time and vehicle type. i know the code inst even closed to finished im just looking to get ride of the unresolved external because I've gotten in before and couldn't get rid of it.
void getdata (int* hourin, int* minin, int* hourout, int* minout);
void carcharges (int hourin, int minin, int hourout, int minout, int charge, int minutes, int hours);
void output (int hourin, int minin, int hourout, int minout,int roundedtime, int minutes, int hours);
int main (void)
{
char type;
int hourin;
int minin;
int hourout;
int minout;
int totalhours;
int charge;
int hours;
int minutes;
int roundedtime;
float total;
printf("Type of vehicle (c - t - b) ");
scanf("%c\n", &type);
getdata (&hourin, &minin, &hourout, &minout);
if (type == 100)
carcharges (hourin, minin, hourout, minout, charge, minutes, hours);
else if (type == 117)
printf("truck");
else if (type == 99)
printf("bus");
else
printf("Invalid");
You declare cracharges as taking only int parameters: void carcharges (int hourin, int minin, int hourout, int minout, int charge, int minutes, int hours);
But then you define an overloaded version that takes some int pointers and ints: void carcharges (int* hourin, int* minin, int* hourout, int* minout, int charge, int minutes, int hours)
You either need to change the declaration or the definition.
That fixed it thanks for the help. I don't mean to be a burden but my teacher doesn't really teach. now its saying that when i call the output function hours, minutes and charge are being called without being initialized.
If you used the pointer version of the function, when you call the function you need to use the & operator on the variables. I'd recommend using references instead.
when i have them input the type of vehicle i need to be able to tell what function to call but when i try to test it and i put in c, t or b it just goes right over the if statement and goes to the output function.
if (type == 'c')
carcharges (&hourin, &minin, &hourout, &minout, charge, minutes, hours);
else if (type == 't')
printf("truck");
else if (type == 'b')
printf("bus");
this is what i have right now, how to i make it so it actually uses the if statement.