/* This program will ask the user to enter 3 integers
Then it will store into an array, and prints out
The integers that were store into the array.
It's a simple demonstration of using array
*
*/
#include<iostream>
using namespace std;
int main()
{
/* This declares score as an array that can hold 3 integers
*
*/
int score[3];
/* This is the for loop that is used to ask the user to enter
A series of 3 integers to store into the array
*
*/
cout<<"Enter 3 number: \n";
for(int i = 0; i < 3; i++)
{
cin>>score[i];
}
/* This is the for loop that is used to print out the series
Of integers.
*
*/
cout<<"The numbers you enter are : ";
for(int i = 0; i < 3; i++)
{
cout<< "\n"<<score[i];
}
cout<<"\n";
/* System Pause used to pause the output window
The latest version complier do not
require it
*
*/
system("PAUSE");
return 0;
}

< C++ >
< Home >