1. ## help 3 ???

Code:
```#include <iostream> /*for cin and cout*/

int main() /*function main*/
{
int num = 0;
float sum= 0;
float avg= 0;
int count = 0;
int largest = 0;
int smallest= 0;
int product = 0;

while (1)				//never ending loop//start loop body
{
std::cout <<"Please enter an integer enter (-1 to stop)";
std::cin >> num;

if (num == -1)
{		break;							//get out of the loop
}    else;
sum += num;						//  start else body
count++;
avg = (sum)/count;

if (count == 1)
{		smallest = largest = num;
}		else;
//	 start else body;
if (num < smallest)
{	 	smallest = num;

if (num > largest)
largest = num;
else;								//end body;
}	else;								//end body;
}										//end loop body;

product = (smallest * largest); //product = num * num??

std::cout << "The number of the integers is " << count << std::endl;
std::cout << "The sum of the integers is " << sum << std::endl;
std::cout << "The average of the integers is " << avg << std::endl;
std::cout << "The product of the integers is " << product << std::endl;
std::cout << "The largest integers is " << largest << std::endl;
std::cout << "The smallest integers is " << smallest << std::endl;

return 0;
}```

this board has been a tremendous amount of help and I have a couple of ???

1) If i enter three intergers into the program say 5 4 2 -1
everything work except my product out put it ends up with 10 instead of say 40, does that statement have to be in the while loop
somewhere???

2) smallest = largest = num; I'm a little confused about this statement if i enter say 5 4 2 is it ending up assigning 2 to num after the program runs???

many thanks to all

2. because it is the product of largest (5) and smallest (2)
5x2=10

Code:
`product = (smallest * largest);`
if you want the product of all numbers: then do smthing like this:
Code:
`product = 1;`
Code:
```sum += num;
product *= num;```

3. cool!! still confused about what

Code:
```if (count == 1)
smallest = largest = num;```

does???

4. that assigns the very first input number to smallest and largest

ie: u entered 5 as ur first num
then largest = num, and smallest = largest

5. what concerns me is....

Code:
`while(1)`
As far as i have seen in my c+ career.. there has been some sort of condition that will at some point, terminate the loop.

example:

Code:
`while (counter < 5)`
or something like

Code:
`while (choice != 'Q')`
I would like to see some sort of variable in your while() loop.. by having only a constant.. i am not sure if your loop will ever terminate.

6. His loop will terminate with this code:
Code:
```if (num == -1)
{
break;    //get out of the loop
}```
break will, as it says, break a loop or switch, so he has a condition where the loop terminates.