Hi, Can anyone fix this code that i have made here. the objective to the program is
-to make an array for an unknown number of integers.
-Quit value is -1.
-Keep track of how many numbers in array
-If array is full output full message (full is 25 numbers even though said unknown numbers)
-and get next value
-display values in array
-end
This is what i have so far please fix whats needed, much appreciation is givin

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{

	//local constants
	const int Quit = -1;

	//local variables
	int Count = 0;    //count for array
	int Number[25] ; //numbers in array
	int Input = 0;
    int i = 0
	/**************************start main program*********************/
	//Enter Intergers
	
	;cout << "\n\n\n\n\n\n\n\n" ;
	cout << setw (50) << "Please enter an integer : ";
	cin  >> Input; 
	cout << "\n\n\n\n\n\n";	
	 

	//While Input is not Quit 
	while (Input != Quit);
	{	
		//Store Input into array and add 1 to count
		Number[i] = Input;
		Count++;
		
	}
		if (Count > 25) //set input to quit display full message
		{
			Input = Quit;
			cout << setw (43) << "Array is full!" << endl;
		}
			else //get next value
			{
			cout << "\n\n\n\n\n\n\n\n" ;
			cout << setw (50) << "Please enter an integer : ";
			cin  >> Input; 
			}
	   
	for (i=0; i<25; i++) //display values
	{
        Number[i] = Input;
        cout >> Number[];
	
	}



	
	
	return 0;
}

Edited 7 Years Ago by Nick Evan: Add code-tags

You need to move your if/else inside of your while loop. Unless the first input is -1, you're just going to keep doing this over and over and over:

Number[i] = Input;
Count++;

because Input will never change from the first input and it won't stop executing the while loop until Input == -1

This article has been dead for over six months. Start a new discussion instead.