Lecture 94
// Loop while
#include <iostream>
#include <conio.h>
using namespace std;
main ()
{
int n,a[5];
cout<<"Initialisation array:\n ";
n=0;
while(n<5)
{
cout<<"Enter the number: ";
cin>>a[n];
n++;
}
cout<<"Print the array :\n";
n=0;
while(n<5)
{
cout<<a[n]<<endl;
n++;
}
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10