c++ code

Thread Starter

TAKYMOUNIR

Joined Jun 23, 2008
352
//this program convert fahrenheit to celisus but when you enter for example f=20 it should make loop and give us the value of celisus which equivalent to 0 to 20(f=0 c=?,f=1 c=?;.......f=20 c=?)
i need to know what is wrong in my code and also how can i submit the code file instead of doing copy and past
thanks

#include
<iostream>
#include<iomanip>
usingnamespace std;
double celisus(double);
int main()
{
double f=0,c=0;
cout<<
"enter temperature value in fahrenheit\n";
cin>>f;
cout<<fixed<<showpoint<<setprecision(2)<<endl;
cout<<
"temperature in celisus"<<"\t\t"<<"temperature in fahrenheit"<<endl;
cout<<
"---------------------------------------------------------------------------\n";
c=celisus(f);

system(
"pause");
return 0;
}
double celisus(double x)
{
double ce;

for(int t=0;t<=x;t++)
{
double ce=0;
ce=5/9*(t-32);

cout<<ce<<
"\t\t\t\t"<<t<<endl;
}
return ce ;
}
 

Attachments

Last edited:
Top