I am trying to make a simple program that does the following:
Program asks an user for 8 inputs, takes each input and put it into an array and then outputs all the elements of the array.
But for some reason the program won't stopping taking taking inputs until I hit enter and then spits out garbage.
Program asks an user for 8 inputs, takes each input and put it into an array and then outputs all the elements of the array.
But for some reason the program won't stopping taking taking inputs until I hit enter and then spits out garbage.
Rich (BB code):
int main()
{
/* Program asks an user for an input and put it to an array
and then list all the elements of the array.
*/
cout<<"Enter 8 characters:"<<endl;
int x;
int array[8];
for(x=0; x<=8; x++)
{
cin>>array[x];
}
/*
cout<<"The listed elements are:"<<endl;
for(x=0; x<8; x++)
{
cout<<array[x]<< endl;
}*/
return 0;
}