typing end to return(0)

Hi again, working on exercises 4. I have finished the assigned but I'm trying to add new line. I tried to add if(end it would end the program. But I cant figure it out.

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
  // Exercises 4

#include "std_lib_facilities.h"

int main()

{

int val1;
int val2;
string end;
start:
	cout << "Please enter first number. OR ------- Type 'end' to exit this cmd.\n";

			cin >> val1;
	
	cout << "Please enter second number, we will tell you which is larger.\n";
			
			cin >> val2;
		
		if(val1 > val2)
	
	cout << val1 << " is greater than " << val2 <<"\n";
	
		if(val1 < val2)
	
	cout << val2 << " is greater than " << val1 <<"\n";
	
		if(val1 == val2)
	
	cout << val1 << " and " << val2 << " is equal.\n";
	
	cout << "\n";
	{
	
		if(end == end)
		
	return(0);
}
goto start;
	
}
Line 36: You're comparing a string to itself.

Line 15: You can't type "end" (per line 13) when cin is expecting an int.

Line 40: Avoid gotos. gotos are evil. Use a loop instead.
Topic archived. No new replies allowed.