Thread: C++ newbie needs help with simple conversion programming

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    4

    C++ newbie needs help with simple conversion programming

    Hi, I'm trying to make a program that converts Fahrenheit into Celsius and Kelvin.

    #include <iostream>
    #include <cmath>
    #include <cstdlib>

    int main(int argc, char *argv[])
    {
    double fah, cel, kel;
    char ans;
    do
    {
    cout<<"Enter the temperature in Fahrenheit: "; // I get error here..."cout" undeclared
    cin>>fah;

    cel = (5.0 / 9.0) * (fah - 32.0);
    kel = (cel + 273.0);

    cout<<"The temperature is "<<cel<<" degree Celsius and "<<kel<<" Kelvin."<<endl;
    cout<<endl<<endl
    <<"Do you want to do this again? ";
    cin>>ans;
    fflush(stdin);
    }while(ans=='Y' || ans == 'y');
    system("PAUSE");
    return EXIT_SUCCESS;
    }
    Last edited by djayyyyy; 10-16-2010 at 10:43 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MFC newbie --- simple problem
    By gemini_shooter in forum Windows Programming
    Replies: 3
    Last Post: 04-03-2006, 04:17 PM
  2. Newbie Help: Currency Converter
    By Ashfury in forum C Programming
    Replies: 10
    Last Post: 11-06-2005, 01:21 PM
  3. Configurations give different results
    By Hubas in forum Windows Programming
    Replies: 2
    Last Post: 04-11-2003, 11:43 AM
  4. Need some really simple help (complete Linux newbie)
    By Hannwaas in forum Linux Programming
    Replies: 11
    Last Post: 12-10-2001, 03:16 PM
  5. Im a Newbie with a graphics design problem for my simple game
    By Robert_Ingleby in forum C++ Programming
    Replies: 1
    Last Post: 11-23-2001, 06:41 PM