Write program that models a college course. Put the declarations for StudentID,
ID: 674816 • Letter: W
Question
Explanation / Answer
#include<iostream.h>
#include<conio.h>
class student
{
int roll;
char name[100];
char course[100];
public:void getData();
void disp(int r1,int r2)
{
if(roll>=r1 && roll<=r2)
cout<<" roll_no:"<<roll<<" name:"<<name<<" course:"<<course;
}
};
void student::getData()
{
cout<<" Enter roll_no,name and course ";
cin>>roll>>name>>course;
}
void main()
{
student s[100];
int n,r1,r2;
clrscr();
cout<<" Enter no of students ";
cin>>n;
for(int i=0;i<n;i++)
s[i].getData();
cout<<" Enter the range ";
cin>>r1>>r2;
for(int j=0;j<n;j++)
s[j].disp(r1,r2);
getch();
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.