Design two base personnel (name, address, e-mail-id, birthdate) and academic (marks in
10th and 12th, class obtain) derive a class biodata from both these class. Develop a
project to prepare a biodata of a student having a personal information and academic
information.
Concepts used: Functions, variables, loops, arithmetic functions, breaks, Class
member functions, inheritance, string stream:
#include <iostream>
using namespace std;
class std_basic_info
{
private:
char name[30];
char address[20];
char e_mail[20];
int d,m,y;
public:
int marks10[3],marks12[3];
void getBasicInfo(void);
void putBasicInfo(void);
};
void std_basic_info::getBasicInfo(void)
{
cout<< "Enter student's basic information:" << endl;
cout<< "Name:"; cin >> name;
cout<< "address:"; cin >> address;
cout<< "e-mail:"; cin >> e_mail;
cout<<"enter dd mm yy:"; cin>>d>>m>>y;
}
void std_basic_info::putBasicInfo(void)
{
cout << "\n Name : " << name << "\n address : " << address << "\n e_mail : " << e_mail << endl;
cout<<"date="<<d<<"/"<<m<<"/"<<y;
}
class std_result_info:public std_basic_info
{
private:
int totalm,total12;
float perc10,perc12;
char grade;
public:
void getResultInfo(void);
void putResultInfo(void);
};
void std_result_info::getResultInfo(void)
{
cout << "Enter student's result information:" << endl;
cout << "Marks obtained in class 10 in three subjects: ";
for( int i=0;i<3;i++)
{
cin>>marks10[i];
}
cout<< "marks obtain in class 12 in three subjects: ";
for( int i=0;i<3;i++)
{
cin>>marks12[i];
}
totalm= marks10[0]+marks10[1]+marks10[2];
total12=marks12[0]+marks12[1]+marks12[2];
perc10= (float)((totalm*100)/300);
perc12= (float)((total12*100)/300);
cout << "Grade?: ";
cin >> grade;
}
void std_result_info::putResultInfo(void)
{
cout << "\n Total Marks in 10th : "<<totalm << "\n Total Marks in 12th: "<<total12 <<"\n Percentage in 10: " << perc10 <<"\npercentage in 12:"<<perc12<< "\n Grade: " << grade << endl;
}
int main()
{
std_result_info std;
std.getBasicInfo();
std.getResultInfo();
std.putBasicInfo();
std.putResultInfo();
return 0;
}
using namespace std;
class std_basic_info
{
private:
char name[30];
char address[20];
char e_mail[20];
int d,m,y;
public:
int marks10[3],marks12[3];
void getBasicInfo(void);
void putBasicInfo(void);
};
void std_basic_info::getBasicInfo(void)
{
cout<< "Enter student's basic information:" << endl;
cout<< "Name:"; cin >> name;
cout<< "address:"; cin >> address;
cout<< "e-mail:"; cin >> e_mail;
cout<<"enter dd mm yy:"; cin>>d>>m>>y;
}
void std_basic_info::putBasicInfo(void)
{
cout << "\n Name : " << name << "\n address : " << address << "\n e_mail : " << e_mail << endl;
cout<<"date="<<d<<"/"<<m<<"/"<<y;
}
class std_result_info:public std_basic_info
{
private:
int totalm,total12;
float perc10,perc12;
char grade;
public:
void getResultInfo(void);
void putResultInfo(void);
};
void std_result_info::getResultInfo(void)
{
cout << "Enter student's result information:" << endl;
cout << "Marks obtained in class 10 in three subjects: ";
for( int i=0;i<3;i++)
{
cin>>marks10[i];
}
cout<< "marks obtain in class 12 in three subjects: ";
for( int i=0;i<3;i++)
{
cin>>marks12[i];
}
totalm= marks10[0]+marks10[1]+marks10[2];
total12=marks12[0]+marks12[1]+marks12[2];
perc10= (float)((totalm*100)/300);
perc12= (float)((total12*100)/300);
cout << "Grade?: ";
cin >> grade;
}
void std_result_info::putResultInfo(void)
{
cout << "\n Total Marks in 10th : "<<totalm << "\n Total Marks in 12th: "<<total12 <<"\n Percentage in 10: " << perc10 <<"\npercentage in 12:"<<perc12<< "\n Grade: " << grade << endl;
}
int main()
{
std_result_info std;
std.getBasicInfo();
std.getResultInfo();
std.putBasicInfo();
std.putResultInfo();
return 0;
}

0 comments: