### Fahrenheit > Celcius

Hi, I am trying to create a little fun program that calculates Fahrenheit to Celcius and opposite, I've only created the Fahrenheit part for now. Thank you!

 ``1234567891011121314151617181920212223`` ``````#include #include using namespace std; int main () { string a; string f; string c; cout << "Hello! Would you like too calculate Fahrenheit into Celcius? Or opposite? If you want fahrenheit > celcius then press 1, if opposite press 2." << endl; getline (cin, a); if (a == '1') { cout << "How many fahrenheit do you want too calculate?" << endl; getline (cin, f); cout << f/1,8; } else { { cout << "How many celcius do you want to calculate?" << endl; } system("PAUSE"); return 0; }``````
I would suggest to not use string and getline here.
 ``123`` `````` string a; string f; string c;``````

would be better as
 ``123`` `````` char a; double f; double c;``````

 ``12`` `````` getline (cin, f); cout << f/1,8;``````

would become
 ``12`` `````` cin >> f; cout << (f - 32)/1.8;``````

@Chervil
Thank you very much! I just tried it and it still doesn't work? It says at the bottom[Warning] In function 'int main()': and: parse error at end of input.
Last edited on
 It says at the bottom[Warning] In function 'int main()': and: parse error at end of input.

The original code had mismatched opening/closing braces { }. At the end of line 17, there is an opening brace `{` and then at the start of line 18 there is another opening brace. One of them has to go.

 ``1234567891011121314151617181920212223242526272829`` ``````#include #include using namespace std; int main () { char a; double f; double c; cout << "Hello! Would you like too calculate Fahrenheit into Celcius?\n" "Or opposite?\n" "Fahrenheit > Celcius press 1,\n" "Celcius > Fahrenheit press 2." << endl; cin >> a; if (a == '1') { cout << "How many fahrenheit do you want too calculate?" << endl; cin >> f; cout << (f - 32)/1.8; } else { cout << "How many celcius do you want to calculate?" << endl; } system("PAUSE"); return 0; }``````