- #1
HoojaMan33
- 15
- 0
Homework Statement
Hi i have an assignment that is asking me to convert 3 temperatures in fahrenheit to celcius and vice versa.
I am very new to programming only 2 weeks in(and i learn by playing with the program) so I do not know all of the terminology / principles.
I am not allowed to use global variables and I have to make function calls and use of call by value parameters.
My current code has many errors I believe and I think i fundamentally do not understand what is going on here, so any help would be great.
Homework Equations
The Attempt at a Solution
Code:
#include <stdio.h>
#include <math.h>
Calculation(float c1, float c2, float c3, float f1, float f2, float f3);
int main()
{
float c1, c2, c3, f1, f2, f3;
float new1, new1, new3;
float newa, newb, newc;
printf("Please type in three temperatures in fahrenheit");
scanf("%f %f %f", &f1, &f2, &f3);
new1 = calc_celcius(f1);
new2 = calc_celcius(f2);
new3 = calc_celcius(f3);
printf("The converted temperatures are: \t %.2f %.2f %.2f", new1, new2, new3);
printf("Please type in three temperatures in celcius");
scanf("%f %f %f", &c1, &c2, &c3);
newa = calc_fah(c1);
newb = calc_fah(c2);
newc = calc_fah(c3);
printf("The converted temperatures are: \t %.2f %.2f %.2f", newa, newb, newc);
return 0;
}
float calc_celcius(float f1, float f2, float f3);
{
float new1 = ((f1 - 32) * .55);
float new2 = ((f2 - 32) * .55);
float new3 = ((f3 - 32) * .55);
return(calc_celius);
}
float calc_fahr(float c1, float c2, float c3);
{
float newa = (c1 * 1.8) + 32;
float newb = (c2 * 1.8) + 32;
float newc = (c3 * 1.8) + 32;
return(calc_fahr);
}
My questions:
1) How do i properly configure my prototype function?
2) How do i properly declare variables locally or using parameters?
3) Is there anything I am missing
Thank you very much !