Using 2 main @_@

This is the question:
Given the temperature conversion formulas from Celsius scale to other scales are as follows:
reamur : 4/5*celcius
fahrenheit : 9/5*celcius + 32
Kelvin : celcius + 273

Make a function that accepts input values ​​of temperature on Celsius scale (real type) and input type desired temperature conversion result (type character) and perform calculations based on the input temperature conversion and display the results.

and this is my program

#include <iostream>
#include <iomanip>

using namespace std;

int main ()
{
float celcius,reamur,fahrenheit,kelvin;
cout << "Program conversion celcius" << endl;
cout << "Type the celcius : " << endl;
cin >> celcius;
reamur = 4/5*celcius;
fahrenheit = (9/5*celcius)+32;
kelvin = celcius + 273;
cout >> "Reamur : " >> reamur >> "Fahrenheit : " >> fahrenheit >> "Kelvin : " >> kelvin >> endl;
system ("pause");
return 0;
}

until this step, i got stuck and don't know how to continue this program, can someone help me fix my c++
First get rid of system("pause");

One of the major problems i see is that you used >> instead of << for display. So basically just replace all the ones after cout.

It seems from your homework that you also need to ask the user for an input to display which conversion they want. You might want to look into switch case or if, else if statements.
Sorry! May someone please tell me what is the #include <iomanip> is used for in here?
Because when I copied this code in VS2010 and deleted that part, nothing changed.
Thank you!
@marvin77 sorry if I asked it in your topic.
Last edited on
#include <iomanip> lets us manipulate our text before sending it to cout. You can put things into scientific notation, display hexidecimal numbers, set column widths for tables, etc.

In the code above, nothing is used from iomanip and it can be removed from the code.

For a list of what it does, see: http://cplusplus.com/reference/iostream/manipulators/
Last edited on
but my teacher told me to use 2 main, i'm now studying the 2 main function... i really can't understand how must i make that program, please help me --"
but my teacher told me to use 2 main, i'm now studying the 2 main function... i really can't understand how must i make that program, please help me --"


Are you sure he didn't tell you to use two functions?
at least we must use 2 functions, because i'm studying to use that, if not, i can easily solve it, but when it's use 2 function, i can't understand --"
Topic archived. No new replies allowed.