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

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. */
}``````

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.

``````#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

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.

how to declare?like int x?

``````#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.

int CF(int C);
int FC(int F);

Where have you defined them?

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.

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.

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

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));
}``````
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.