Error C2784

Following code is producing dozens of C2784 errors and I would like advice on why? I have int as "choice" as I tried Char with C or F to be input and I wondered if that might be contributing. I am sure its something simple - all help received gratefully! (Commented out text does work!)

ad1234

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <math.h>

using namespace std;

int main ()

{
int c, f;
int choice;
int result;

/*cout << "Enter a value in Fahrenheit  you wish to convert to Celsius" << endl;
cin >> f;

c = 5 * (f-32) / 9;

cout << "You entered " << f << " which is " << c << " in degrees celsius." << endl;

return 0;*/

cout << "Enter 1 for C or 2 for F for the temperature you are going to input" << endl;

cin >> choice;

if (choice == 1) {

	cout << "Enter the value for Celsius you want to be converted to Fahrenheit" << endl;

	cin >> c;

	f = (9 * c)/5 + 32;

	result = f;

	cout >> c >> " in degrees fahrenheit is " >> result >> endl;
}

if (choice == 2)
{
	cout << "Enter the value for Fahrenheit you want to be converted to Celsius" << endl;

	cin >> f;

	c = 5 * (f-32) / 9;

	result = f;

	cout >> f >> " in degrees celsius is " >> result >> endl;
}

else {cout >> "That is not a C or F" >> endl;
}

return 0;

}
Last edited on
closed account (z05DSL3A)
cout >> ... is wrong, should be cout << ...
Topic archived. No new replies allowed.