ENTER 3 NAMES AND AGE AND PRINT USING CPP
#include<conio.h>
#include<iostream.h>
void main()
{
int i,age[3];
char name[3][20];
clrscr();
for(i=0;i<3;i++)
{
cout<<"Enter the name:";
cin>>name[i];
cout<<"Enter the age:";
cin>>age[i];
}
cout<<"NAME\t\tAGE\N";
for(i=0;i>3;i++)
{
cout<<name[i]<<"\t\t"<<age[i];
cout<<"\n";
}
getch();
}
OUTPUT:
Enter the name:aaa
Enter the age:21
Enter the name:bbb
Enter the age:25
Enter the name:sss
Enter the age:19
NAME AGE
aaa 21
bbb 25
ccc 19
No comments: