I tried asking this on the c++ board but no luck.

here is my problem. I have a program that ask a user to enter some numbers it then will spit out the max and min and number of numbers he entered.

After that it will ask them if they would like to run the program again. If they choose yes how do I clear out the numbers the entered before.

ex: First run

Numbers Entered: 1, 2, -1, 9

-You entered 4 numbers

- Largest is 9

- Smallest is -1

Second Run:

Numbers Entered: 6, -8, 3, 5

- You entered 8 numbers //Should say 4

- Largest is 9 //Should say 6

- Smallest is -8 //This is right.

This is only my second program I have written so I am still a novice at this and can not figure out what to do. What is the code and where do I put it in this program?

/* Name: Nicholas Dillon Febuary 21, 2002

*

*

* Assign2.cpp

*

* This program finds the max and the min out of a group of numbers.

*

*

* input:

*

* numbers

*

* ouput:

*

* max - largest number entered

* min - smallest number entered

*

*

*/

#include <iostream.h>

int main()

{

const int MAX = 50; //Max size of array

int count = 0; //Counts # of items entered

int index = 0; //loop variable

int numbers_array[MAX]; //Array to store numbers

char ch = 'Y'; //Run again variable

int max; //Maximum Variable

int min; //Minimum Variable

int i = 0; //variable

do

{

while(ch == 'Y' || ch == 'y')

{

cout << "Please enter a number: "; endl;

cin >> numbers_array[index];

index++;

count++;

cout << "Please enter a number: "; endl;

cin >> numbers_array[index];

index++;

count++;

endl;

cout << "Do you want to enter another number?(Y/N) ";

cin >> ch;

}

min = numbers_array[0];

max = numbers_array[0];

while (i < count)

{

if (numbers_array[i] < min)

{

min = numbers_array[i];

}

else if(numbers_array[i] > max)

{

max = numbers_array[i];

}

i++;

}

cout << "You entered a total of " << count;

cout << " numbers." <<endl;

cout << "The largest number you entered was " << max << endl;

cout << "The smallest number you entered was " << min << endl;

cout << "Would you like to run program again?(Y/N)";

cin >> ch;

}

while (ch == 'Y' || ch == 'y');

return 0;

}

Thanks for the help! I dont knwo what the he!!to do!