c++ code

Discussion in 'Homework Help' started by TAKYMOUNIR, Oct 29, 2011.

  1. TAKYMOUNIR

    Thread Starter Active Member

    Jun 23, 2008
    351
    1
    //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 ;
    }
     
    Last edited: Oct 30, 2011
  2. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    Have you tried uploading the code file as an attachment? If your file type gets rejected you could upload it as a .txt at the worse.
     
    TAKYMOUNIR likes this.
Loading...