Saturday, 12 December 2015

WRITE A program that input the name and marks of students of BSCS/IT and dispaly the name of student who got highest marks and show lowest marks with name of student

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{ int max,min,roll1,roll2,n;
cout<<"enter strength of class BSCS/IT = ";
cin>>n;
int marks[n],roll[n];
string name[n],name1,name2;
for(int a=0;a<n;a++)
{  cout<<"enter roll number = "<<endl;
  cin>>roll[a];
  cout<<"enter name of roll number "<<endl;
  cin>>name[a];
  cout<<"Enter marks of  student"<<endl;
  cin>>marks[a];
  max=min=marks[a];}
for(int a=0;a<n;a++)
{
  if(max<marks[a])
 {
  max=marks[a];
  name2=name[a];
  roll2=roll[a];}
if(min>marks[a])
{
 min=marks[a];
 name1=name[a];
 roll1=roll[a];}
}
cout<<name2<<" roll number "<<roll2<<" got maximum marks = "<<max<<endl;
cout<<name1<<" roll number "<<roll1<<" got minimum marks = "<<min;
getch();
}

No comments:

Post a Comment