0

here is the things so far i got.

#include <stdio.h>
int CF(int C);
int FC(int F);
int main(){
printf("Fahrenheit equivalents of Celsius temperature\n");
printf("Celsius \t Fahrenheit \n");
for (x=0;x<=100;x++);

printf("Celsius equivalents of Fahrenheit temperature\n");
printf("Fahrenheit \t Celsius \n");
for (x=32;x<=212;x++);

Pls,somebody help me.T.T

Edited by sing1006: n/a

4
Contributors
11
Replies
13
Views
7 Years
Discussion Span
Last Post by sing1006
0

The conversion formula is:

C = (F - 32) * (5 / 9)

and

F = (C * 9 / 5) + 32

So,

for (x=0; x <= 100; x++) {
    printf("%d %d", x, CF(x));
}

int CF(int C)
{
    /* calculate the formula here and return the needed value. */
}

Edited by myk45: n/a

0

erm,still got 2 problem.1st,i need to put in the formula,right?where and how should i put in.2nd,is about the integer x.i also need to add x into function main right?sigh,i am newbie.a lot of basic things still dont understand.

0
#include <stdio.h>
int CF(int C);
int FC(int F);
int main (){

printf("Fahrenheit equivalents of Celsius temperature\n");
printf("Celsius\t\tFahrenheit\n");

for (x=0;x<=100;x++){
printf("%d\t%d\n",x,CF(x));
C = (F - 32) * (5 / 9);
}

printf("Celsius equivalents of Fahrenheit temperature\n");
printf("Fahrenheit\tCelsius\n");
for (x=32;x<=212;x++){
printf("%d\t%d\n",x,FC(x));
F = (C * 9 / 5) + 32;
}
return 0;
}

Error E2451 ass22.c 5: Undefined symbol 'C' in function main
Error E2451 ass22.c 5: Undefined symbol 'F' in function main
Error E2451 ass22.c 10: Undefined symbol 'x' in function main

Edited by sing1006: n/a

0

You have to declare your variables, before you can use them. Generally, it's best to declare them, right at the top of the function they are used in.

0
#include <stdio.h>
int CF(int C);
int FC(int F);
int main (){
int x;

printf("Fahrenheit equivalents C=(F-32)*(5/9)\n");
printf("Celsius\t\tFahrenheit\n");
for (x=0;x<=100;x++){
printf("%d\t%d\n",x,CF(x));
}

printf("Celsius equivalents F=(C*9/5)+32;\n");
printf("Fahrenheit\tCelsius\n");
for (x=32;x<=212;x++){
printf("%d\t%d\n",x,FC(x));
}
return 0;
}

i still cant solve it.help.these r the thing i got now.

0

Where are your functions?
int CF(int C);
int FC(int F);

Where have you defined them?

0

ya,i also got notice about those 2 but how to defined?defined as what?this thing really drop me crazy.now here already 3.45am.i nd go to sleep.2moro still got class.sigh.

0

You need to write functions for conversions.

You have declared them, but not defined them.
int CF(int C);
int FC(int F);

Well, you can learn about functions from tutorials on the Internet, but i suggest you read a good book and learn about functions.

0

And keep in mind 5/9 = 0. That's integer arithmetic. You want 5.0/9.0 to get the correct answers.

0

Thanks a lot,guys.I manage to get the answer from my lecturer.Here is the code for ppl to refer or do as reference.

#include <stdio.h>
int CF(int C);
int FC(int F);
int main (){
int x;

printf("Fahrenheit equivalents of Celsius temperature\n");
printf("Celsius\t\tFahrenheit\n");

for (x=0;x<=100;x++){
printf("%d\t\t%d\n",x,CF(x));
}

printf("Celsius equivalents of Fahrenheit temperature\n");
printf("Fahrenheit\tCelsius\n");

for (x=32;x<=212;x++){
printf("%d\t\t%d\n",x,FC(x));
}
return 0;
}

int CF( int C){
return (int)(32+(C * 9 / 5));
}

int FC(int F){
return (int)(5.0 /9.0 *(F-32));
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.