Celcius to fahrenheit

Sep 5, 2012 at 7:41am
i am very new to c++ programming and i have a homework tomorrow pls help me on this one.

i have to make a program that convert celcius to fahrenheit. i can see it is working but after i type in some number, it doesnt show the result but it just closes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//this program converts celcius temperature to fahrenheit temperature
#include <iostream>
using namespace std;
int main()
{
  double
  celcius,
  fahrenheit;
  
  cout << "Enter the Celcius Temperature" << endl;
  cin  >> celcius;
  
  fahrenheit=9/5*celcius+32;
  
  cout << "Fahrenheir= " << fahrenheit << endl;
  cin.get();
  return 0;
  
}
Last edited on Sep 5, 2012 at 7:41am
Sep 5, 2012 at 7:48am
Use

cin.ignore();

before cin.get();
Sep 5, 2012 at 7:49am
Just add another cin.get(); before the return 0; statement.
Sep 5, 2012 at 7:49am
tyvm madguy!!
Sep 5, 2012 at 8:45am
@MarkJason

the two suggestions will work!!!
Topic archived. No new replies allowed.