Last active
January 12, 2017 18:56
-
-
Save iamshouvikmitra/3336b84e50164f35e57d24ec71aadfbc to your computer and use it in GitHub Desktop.
create a class private: Name, Roll no Protected: Subject, Branch, class Public: Function "sum" to add 5 subject marks Function show to show the marks in total
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
#include <conio.h> | |
using namespace std; | |
class Main | |
{ | |
private: | |
char Name[20]; | |
int roll; | |
protected: | |
int subject; | |
char branch; | |
char Class; | |
public: | |
int a, b, c, d, e, sum; | |
int add() | |
{ | |
cout<<"Performing addition"; | |
cin>>a>>b>>c>>d>>e; | |
sum=a+b+c+d+e; | |
} | |
void show() | |
{ | |
cout<<sum; | |
} | |
}; | |
int main() | |
{ | |
Main obj; | |
obj.add(); | |
obj.show(); | |
getch(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment