#include <iostream>
using namespace std;
class student
{
public:
int roll_no,mark1,mark2;
void get()
{
cin>>roll_no>>mark1>>mark2;
}
};
class sports
{
public:
int mark3;
void getagain()
{
cin>>mark3;
}
};
class statement : public student, public sports
{
public:
void display()
{
cout<<"Roll No:"<<roll_no<<endl;
cout<<"Total:"<<mark1+mark2+mark3<<endl;
cout<<"Average:"<<(mark1+mark2+mark3)/3<<endl;
}
};
int main()
{
statement obj;
obj.get();
obj.getagain();
obj.display();
return 0;
}
using namespace std;
class student
{
public:
int roll_no,mark1,mark2;
void get()
{
cin>>roll_no>>mark1>>mark2;
}
};
class sports
{
public:
int mark3;
void getagain()
{
cin>>mark3;
}
};
class statement : public student, public sports
{
public:
void display()
{
cout<<"Roll No:"<<roll_no<<endl;
cout<<"Total:"<<mark1+mark2+mark3<<endl;
cout<<"Average:"<<(mark1+mark2+mark3)/3<<endl;
}
};
int main()
{
statement obj;
obj.get();
obj.getagain();
obj.display();
return 0;
}
not working
ReplyDeleteThis comment has been removed by the author.
ReplyDelete//working code
ReplyDelete#include
using namespace std;
class student
{
public:
int rollno,mark1,mark2;
void get()
{
cin>>rollno>>mark1>>mark2;
}
};
class sports
{
public:
int mark3;
void get1()
{
cin>>mark3;
}
};
class statement:public student,public sports
{
public:
void display()
{
cout<<"Roll No:"<<rollno<<endl;
cout<<"Total:"<<mark1+mark2+mark3<<endl;
cout<<"Average:"<<(mark1+mark2+mark3)/3<<endl;
}
};
int main()
{
statement obj;
obj.get();
obj.get1();
obj.display();
return 0;
}
Nice
Deletenot working
Deleteworking 100%
DeleteJust add } after return 0; it will work
ReplyDeletejust remove spaces in some statements
ReplyDelete