Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (0)

Powered by Vanilla. Made with Bootstrap.
C++ Basic Temperature Converter
  • Xin
    Posts: 3,251
    //
    // Conversion - Program to convert temperature from Celcius Degrees into Fahrenheit:
    // Fahrenheit = Celcius * (212 -32)/100 + 32
    #include <cstdio>
    #include <cstdlib>
    #include <iostream>

    using namespace std;

    int main(int nNumberofArgs, char* pszArgs[])
    {
    // enter the temperature in Celsius
    int celcius;
    cout << \"Enter the Temperature in Celsius:\";
    cin >> celcius;

    //calculate conversion factor for Celsius
    // to fahrenheit
    int factor;
    factor = 212 - 32;

    // use conversion factor to convert Celcius
    // into fahrenheit values
    int fahrenheit;
    fahrenheit = factor * celcius/100 + 32;

    // output the results (followed by a Newline)

    cout << \"Fahrenheit value is:\";
    cout << fahrenheit << endl;

    // wait untul user is ready before terminating program
    // to allow the user to see the program results
    system(\"PAUSE\");
    return 0;
    }
    Xin
  • DizzY
    Posts: 155
    O.o looks like C++, what's the difference between

    #include <iostream>
    and
    #include <iostream.h>
  • Sh3llc0d3
    Posts: 1,910
    said:


    O.o looks like C++, what's the difference between

    #include <iostream>
    and
    #include <iostream.h>



    Mostly now people use <iostream> as it is recognised without the filetype '.h' after it which shows it is a C++ header file.