You are required to develop a simple result sheet generator for an Advanced level class.
Assume that class consists of 30 students and each student follows a subject. Implement your
result sheet generator as a menu driven C++ application. Your program should read 30 students
marks from the keyboard and print mark, grade sheet and summary sheet as per the details
given below.
i. Draw a top-level design diagram for the above problem.
#include <iostream>
using namespace std;
#define MAX 10
class student
{
private:
char name[30];
int grade;
public:
void obtainDetails(void);
void enterDetails(void);
void summDetails(void);
};
void student::obtainDetails(void){
cout << "Enter name: " ;
cin >> name;
cout << "Enter marks: ";
cin >> grade;
}
void student::enterDetails(void){
cout<<grade<<endl;
}
void student::summDetails(void){
cout << "Name:"<< name <<" grades:" <<grade<<endl;
}
int main()
{
student std[MAX];
int num,loop;
cout << "Enter total number of students: ";
cin >> num;
for(loop=0;loop< num; loop++){
std[loop].obtainDetails();
}
cout << endl;
cout<<"Grade sheet"<<endl;
for(loop=0;loop< num; loop++){
std[loop].enterDetails();
}
cout<<"Summary sheet"<<endl;
for(loop=0;loop< num; loop++){
std[loop].summDetails();
}
return 0;
}
Comments
Leave a comment