Write a program that uses two arrays to store the roll number and marks of students.It inputs roll numbers and marks of five students and stores them in corresponding elements of the arrays. The program finally displays the roll number and marks of the students with highest marks.
#include <iostream.h>
#include <conio.h>
int main ()
{
int rno[5], marks[5];
int i;
int i;
cout<< "Enter roll number and marks of the student: " ;
for(i = 0;i<5;i++)
cin>>rno[i] >>marks[i];
max = 0;
for(i = 1;i <5;i++)
if(marks[i]>marks[max])
max = i;
cout<< "The student with highest marks: " <<endl;
cout<< " Roll Number: " <<rno[max]<<endl;
cout<< " Marks: " <<marks[max];
return 0;
}
cout<< " Roll Number: " <<rno[max]<<endl;
cout<< " Marks: " <<marks[max];
return 0;
}
this code is not running? how is this correct?
ReplyDeletethe code is running just take int data type before the max variable dear
ReplyDelete