Thursday, 12 April 2012

Addition Program In C++

Addition Program In C++
this is simple addition program for given two value
Sample Output:

Code:


/* www.mycfiles.com - Addition Program In C++*/
#include<iostream.h>
#include<conio.h>
class Add{
private:
int a,b,c;
public:
void getdata(){
cout<<"Enter The Values For The Addition\n";
cin>>a>>b;
}
void show(){
cout<<"Addition = "<<c;


}
void add();
};
void Add::add(){    //Here The Scope Resolution Operator Is Used
c=a+b;             //In Simple Words When Any Method Is Defined Outside Of The Class
}                 //This Operator Should Be Used
void main(){
/* The Object For Class Add Is "a"
This Is The Syntax To Create Object
Class_Name Object_Name*/
clrscr();
Add a;
a.getdata();
a.add();
a.show();
getch();


}

Comment bellow for your Query and Feedback.

No comments:

Post a Comment