Thread: Celsius to Farenheit program

  1. #1
    Registered User
    Join Date
    Sep 2008

    Question Celsius to Farenheit program

    I need to write a code that tells me "It is freezing" when is below 32 and "It is not freezing" when above 32 degrees. I'm a begineer on this things and the code below a friend helped me so don't assume I understand evrything about programming.

    These code only converts F->C How can i modify it to say "It is freezing" and "It is not freezing" can you please post the code thanks

    //robert cruz
    #include <iostream>
    using namespace std;
    int main (void){
    //define variables
    float c = 0.0;
    int f = 0;
    //request inputs
    cout << "Enter temperature in C ";
    cin >> c;
    f = c * 9 / 5 + 32;
    //show results
    cout << endl << " This temperature in F is "<< f << endl;
    return 0;

  2. #2

  3. #3
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    Your results will be off if you use integer division like that.

    f = c * 1.8 + 32.0;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  4. completed a program; desire input
    By spirited in forum C++ Programming
    Replies: 2
    Last Post: 05-25-2003, 08:50 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM