My outside loop not using the sentinel value


I am in an indefinate loop and I am unable to see why. Can anyone help?
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

int main()
{
	char process;
	int amount1 = 0;
	do
	{
		
		cout << "Please input the divers\n";
		cout << "name";

		string diver;
		cin >> diver;

		cout << "Please input the diver's\n";
		cout << "city";

		string city;
		cin >> city;

		double high = 0;
		double low = 0;
		double total = 0;
		int amount1 =0;
		int judge1 = 1;
		
	
			do
			{
				
				cout << "Please input the diver's score";
				double score;
				cin >> score;

				judge1++;

				if(score < 0 || score > 10)
					cout << " Please enter a score between 1 and 10";

				
				if (score < high)
					score = low;
				else 
					score = high;
				
				
				score += total;
				

				
				int amount = amount1;
				amount++;

			}
			while (judge1 < 6);

				if (judge1 = 5)
				{
					

					cout << "Please input the level of difficulty";
					double diff;
					cin >> diff;

					if (diff < 1 || diff > 1.67)
						cout << "Invalid Range difficulty has to be between 1 and 1.67";

					
				}
			

	
	
	cout << "Is there another diver?";
	cin >> process;
	}
	while (process != 'Y' || process != 'y');

	
	cout << " Event Summary ";
	cout << " Number of divers participating:" << amount1;
return 0;
}

Last edited on
Your while statement is as follows:

while (process != 'Y' || process != 'y');

This will return 1 of process doesn't equal 'Y' OR if it ever doesn't equal 'y'.

Tell me, when is it possible that process will ever not equal one of them? If process if 'Y', then it's not 'y'. If process is 'y', then it's not 'Y', so this statement will always return true.
Thanks. My thought process was backwards. I was thinking that the loop was ran only if not what I wanted, but with what you pointed out I was able to get it to work. Thanks again.
Topic archived. No new replies allowed.