Answer to Question #20902 in C++ for ritimukta mohapatra

Question #20902
write a c++ program to addition of two number in which one member function definition is inside the class
1
Expert's answer
2012-12-20T07:37:43-0500

#include <iostream>
#include <conio.h>
#include <time.h>
using namespace std;

class Number{
public:
int number;

};

//main function
int main()
{
Number num1;
Number num2;
num1.number=50;
num2.number=100;

int sum=0;
sum=num1.number+ num2.number;
cout<<sum;
getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS