#include<iostream>
using namespace std;
class Question
{
private :
int QuestionID;
string QuestionType;
int QuestionMarks;
public :
Question()
{
cout<<"Enter Question ID : ";
cin>>QuestionID;
cout<<"Enter Question Type : ";
cin>>QuestionType;
cout<<"Enter Question Marks : ";
cin>>QuestionMarks;
}
void setQueID(int id)
{
QuestionID=id;
}
void setQueType(string type)
{
QuestionType=type;
}
void setQueMarks(int marks)
{
QuestionMarks=marks;
}
int getQueID() const
{
return QuestionID;
}
string getQueType() const
{
return QuestionType;
}
int getQueMarks() const
{
return QuestionMarks;
}
};
class Exam
{
private :
string ExamType;
string CourseCode;
static const int NoOfQuestions=2;
Question *questions[NoOfQuestions];
public :
Exam(string EType, string CCode)
{
ExamType=EType;
CourseCode=CCode;
for(int i=0; i<NoOfQuestions; i++)
{
cout<<"\n***** Enter Data of Question No. "<<i+1<<" *****\n";
questions[i] = new Question();
}
}
void DisplayInfo()
{
cout<<"----------------------------\n";
cout<<"**** Displaying Exam Information ****";
cout<<"\n----------------------------";
cout<<"\nExam Type : "<<ExamType;
cout<<"\nCourse Code : "<<CourseCode;
cout<<"\nTotal No of Questions for Exam : "<<NoOfQuestions;
cout<<"\n----------------------------\n";
cout<<"**** Displaying Question Information ****";
cout<<"\n----------------------------";
for(int i=0; i<NoOfQuestions; i++)
{
cout<<"\nQuestion No. : "<<i+1;
cout<<"\nQuestion Id : "<<questions[i]->getQueID();
cout<<"\nQuestion Type : "<<questions[i]->getQueType();
cout<<"\nQuestion Marks : "<<questions[i]->getQueMarks();
cout<<"\n----------------------------";
}
}
};
main()
{
cout<<"\n\t\tCS304 Assignment No. 2 Solution \n";
cout<<"\nPlease Subscribe Cyberian Youtube Channel to get Solutions of all Programming Assignments\n\n";
string type, code;
cout<<"Enter Exam Type : ";
getline(cin, type);
cout<<"Enter Course Code : ";
getline(cin, code);
Exam exm1(type,code);
exm1.DisplayInfo();
}