Friday, 11 December 2015

wite a program that inputs total numbers of students in class and input name of students and marks of student....and output highest marks and minimum marks with array

#include<iostream>
using namespace std;
main()
{ int max,min;
int marks[5];
string name[5];
for(int a=0;a<5;a++)
{
cout<<"enter name of roll number "<<a+1<<endl;
cin>>name[a];
 cout<<"Enter marks of  student"<<endl;
cin>>marks[a];}
min=max=marks[0];
for(int a=0;a<5;a++)
{
if(max<marks[a])
 max=marks[a];
if(min>marks[a])
min=marks[a];}
cout<<"maximum marks are "<<max<<endl;
cout<<"minimum marks are "<<min;
}

No comments:

Post a Comment