#include<iostream.h>
#include<conio.h> // for clrscr()
class Student
{
protected :
int rollno;
public:
void getrollno(int);
void prnrollno(void);
};
void Student :: getrollno(int a)
{ rollno=a;
}
void Student :: prnrollno(void)
{
cout<<"Roll No : "<<rollno<<"\n";
}
class Test : public Student
{
protected:
float sub1;
float sub2;
float sub3;
float total;
float perc;
char grade;
void calc(void);
public :
void getmarks(float, float, float);
void disp_result(void);
};
void Test :: calc(void)
{
total = sub1 + sub2 + sub3;
perc= (total/300)*100;
if(perc<40.00)
grade='D';
else if(perc<50.00)
grade='C';
else if(perc<60.00)
grade='B';
else
grade='A';
}
void Test :: getmarks(float x, float y, float z)
{
sub1 = x;
sub2 = y;
sub3 = z;
}
void Test :: disp_result(void)
{
calc();
cout<<"The Result is ...\n";
prnrollno();
cout<<"Subject1:"<<sub1<<"\n";
cout<<"Subject2:"<<sub2<<"\n";
cout<<"Subject3:"<<sub3<<"\n";
cout<<"Total:"<<total<<"\n";
cout<<"Grade:"<<grade<<"\n";
}
int main()
{
clrscr();
Test s1;
// process student
int rno;
cout<<"Enter Roll Number : ";
cin>>rno;
s1.getrollno(rno);
float f1,f2,f3;
cout<<"Enter marks in three subject:\n";
cin>>f1>>f2>>f3;
s1.getmarks(f1,f2,f3);
// display result
s1.disp_result();
getch();
return 0;
}
SiteMap
|
Link Us
...Language...
English
French
German
Hindi
Italian
Russian
Japanese
Chinese
Home
|
About Us
|
Portfolio
|
Services
|
Career
|
Contact Us
|
Industrial Training
|
Achievement
Corporate Services
Web Design and development
Web Promotion (SEO)
Multimedia/CD Presentation
Software development
E.Commerce
Training@balujalabs
Software Courses
Hardware Courses
Networking.Courses
Mobile Repairing Courses
UGC Degrees
Student Corner
Programming & Projects
Placement Papers
Project Ideas
Synopsis Ideas
Franchise Section
Administrator
Franchise Inquiry
The following incomplete program takes information about students and their marks and their displays their result. Complete it by filling up their blanks (Grade is ‘A’ for percentage>=60.00, ‘B’ for 50-55.99 ‘C’ for 40-49.99 and ‘D’ for<40).
1
Program to enter the information of an employee and then display it using the single inheritance concept (one base class and one derived class).
2
Program to enter the information of a student and then display it using the single inheritance concept.
3
Program to enter the information of x number of student and display it using the multilevel inheritance concept.
4
Program using multilevel inheritance to get the data from two base classes and display it using the derived class.
5
Program to demonstrate the use of nested classes taking example of train information.
6
Write a C++ program to read and display information about employees and managers. Employee is the base class and Manager is the sub class.
7
The following incomplete program takes information about students and their marks and their displays their result. Complete it by filling up their blanks (Grade is ‘A’ for percentage>=60.00, ‘B’ for 50-55.99 ‘C’ for 40-49.99 and ‘D’ for<40).
8
A railway reservation counter needs to computerize its reservation process. Using the following information write C++ Program to do so.
Home
|
About Us
|
Portfolio
|
Services
|
Career
|
Contact Us
|
Industrial Training
|
Achievement