#include<iostream.h>
#include<conio.h>
class student
{
int rollno;
char name[50];
public:
student()
{
cout<<"Enter the Rollno : ";
cin>>rollno;
cout<<"Enter the Name : ";
cin>>name;
}
virtual void show()=0;
};
class test : public student
{ float total;
float sub[5];
public:
test();
void show();
};
test::test()
{
total=0;
cout<<"\tEnter Marks\n";
for(int i=0;i<5;i++)
{
cout<<"Subject "<<i<<": ";
cin>>sub[i];
total+=sub[i];
}
}
void test::show()
{
cout<<"\n Total : "<<total;
}
int main()
{
clrscr();
test obj;
obj.show();
getch();
return 0;
}
0 comments:
Post a Comment