event only numbers?

Okay, I'm trying to do a lot of my labs for my C++ class because I'm a little behind so please try to answer.. I can ask tomorrow in class but just wanting to know what this means so I can get it done tonight. My professor gave us half of a program with these examples:

Part A. A counter controled while loop
Part B. Sentinel/Event controled while loop loop
Part C. Sentinel/Event controled loop -break out within the loop

basically gave us a model of each..which I get all these loops, but then there is the part he wants us to do which matches his set:

Part A. Write a counter-controled while-loop to process only event numbers
Part B. Write an event-controled while-loop to process only event numbers
Part C. Write an event-controled while-loop to process only event number This breaks within the loop

I don't understand the "process only event numbers". What numbers are these? I'm sorry if this is a dumb question, I actually thought he meant even numbers at first but I don't think so.. Can anyone please help me?
Lol, thats what I thought too >.>

Ummm...I'm just guessing but, maybe the numbers that are inputted to the program? If you have the code that he gave you, it might help us.
Sorry.. I should have posted that first but I don't think it has much on it.. It took me like an hour to fix all the problems his part had.. I hope he did that on purpose.. I couldn't even run it when I tried to test it.. :/ I really want to know what he means about event numbers because this program and the next two are the same, except he changes the types of loops to for, and do-while..

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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#include < iostream >
#include <fstream >
#include < string >
#include < cstring >
#include < cmath> 
#include <cstdlib>
#include <iomanip>

using namespace std; 

int main( )
{
	//variable declarations
	int number;					//var to store an int value
	int sum, min, max, avg;		//vars to store simple statistical info
	int counter;				//a counter for controling the loop
	int size;					//another counter

	/************************************************************
	 Part A. A counter controled while loop
	 ************************************************************/
	cout<<"************** Play Counter Controled do-while-Loop************"; 
	
	//initialization
	sum=min=max=avg =0;
	cout<<"\n\n Enter How many integers do you want to play with? => "; 
	cin>>counter;				//get the counter
	size = counter;				//memory the counter
	counter=0;
	
	//start the loop
	while (counter!=size)
	{	
		cout<<" Enter an integer ==> ";				
		cin>>number;			//get a number
		sum += number;
		
		 if (counter==0)
			  max=min=number;
		
		 if (number > max)
				max = number;
			
		 if (number < min)
				 min = number;
		
		counter++; 
	} 

	cout<<" You entered " << counter << " integers. " <<endl
		<<" The sum is " << sum <<endl 
		<<" The max is " << max <<endl
		<<" The min is " <<min<<endl
		<<" The Avg is " << sum / size<<endl; 

	/************************************************************
	 Part B. Sentinel/Event controled while loop loop
	 ************************************************************/
	cout<<"\n************** PLay Sentinel/Event controled while Loop************"; 
	cout<<"\n\n Compute simple stats of integers. Stop -99 is entered.";	
	//intitialization
	counter=sum=min=max=avg =0;
	cout<<"\n Enter an integer ==> ";				
	cin>>number;	
	
	//start the loop
	while (number != -99)
	{
		 if (counter==0)
			  max=min=number;
		counter++;			//count numbers
		sum += number;
		
		if (number > max)
			max = number; 
		if (number < min)
			min = number;
		
		cout<<" Enter an integer ==> ";				
		cin>>number;	
	}
	
	cout<<" You entered " << counter << " integers. " <<endl
		<<" The sum is " << sum <<endl
		<<" The max is " << max <<endl
		<<" The min is " <<min<<endl
		<<" The Avg is " << sum / counter <<endl; 


	/************************************************************
	 Part C. Sentinel/Event controled loop -
		break out within the loop 
	 ************************************************************/
	cout<<"\n************** Play Sentinel/Event controled while-loop************\n"
		<<"************** Break out within the loop **************************\n\n"; 
	cout<<" Compute simple stats of integers. Stop -99 is entered."; 
	//initialization
	counter=sum=min=max=avg =0;

	//start the loop
	while (true)		//loop forever but break from within
	{ 
		//get a number
		cout<<" Enter an integer ==> "; 
		cin>>number; 

		if (number == -99) //check for event -99. If happened, then break 
		{
			cout<<" Event -99 happened, so break out......... "<<endl; 
			break; 
		}
		counter += 1; 
		sum += number;
		if (counter==1)
			  max=min=number;
		if (number > max)
			max = number; 
		if (number < min)
			min = number; 
		
	}
	cout<<" You entered " << counter << " integers. " <<endl
		<<" The sum is " << sum <<endl
		<<" The max is " << max <<endl
		<<" The min is " << min<<endl
		<<" The Avg is " << sum/counter<<endl; 



	/*********************************************************************************
	 The following three parts are for you to complete.
	 *********************************************************************************/
	/*********************************************************************************
	 Part A. Write a counter-controled while-loop to process only event numbers
	 *********************************************************************************/
	 //your codes are here:

	/*********************************************************************************
	 Part B. Write an event-controled while-loop to process only event numbers
	 *********************************************************************************/
	 //your codes are here:

	/*********************************************************************************
	 Part C. Write an event-controled while-loop to process only event numbers
	 This breaks within the loop
	 *********************************************************************************/
	 //your codes are here:

	//well done and exit
	return 0; 
}


I figured it out.. It was "process only even" numbers.. It took about an hour to correct all the mistakes his part originally had so I'm not surprised he typed in event instead of even in all 3 projects, 3 times in each one!! Sorry about that.... :)
Topic archived. No new replies allowed.