Ads Top

PRINT THE DETAILS OF STUDENT WITH GREATEST MARK UISNG CPP

#inclued<conio.h>
#include<iostream.h>
void main()
{
int i,age[3],tmark[3],g=0,p=0;
char name[20];
clrscr();
for(i=0;i<3;i++)
{
  cout<<"Enter the name  :";
  cin>>name[i];
  cout<<"enter the age :";
  cin>>age[i];
  cout<<" total mark:";
  cin>>tmark[i];
}
for(i=0;i<3;i++)
{
 if(g<tmark[i])
  {
  g=tmark[i];
  p=i;
  }

 }
cout<<"NAME\t\tAGE\t\tTOTALMARK\N";
 for(i=0;i<3;i++)
{
  cout<<name[i]<<"\t\t"<<age[i];
  cout<<"\t\t"<<tmark[i]<<"n\";
}
cout<<"\n\n the greatest mark is"
<<g<<"\t"<<name[p]<<"\t"<<age[p];
getch();
}

OUTPUT:

Enter the name  :sss
Enter the age :21
 total mark:563
Enter the name  :rrr
Enter the age :22
 total mark:342
Enter the name  :aaa
Enter the age :21
 total mark:457

NAME                 AGE           TOTALMARK
sss                           21                      563
rrr                          22                      342
aaa                          21                      457

 The greatest mark is563        sss     21

No comments:

Touchfeeds. Powered by Blogger.