rahul.6sept
Full Member level 5
- Joined
- Nov 17, 2006
- Messages
- 243
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,298
- Location
- Guwahati, India
- Activity points
- 2,889
Dear all,
I've an incomplete c++ code give as below:
1) Case 1: When input = 25 , Output = 0 , 25 , 25
2) Case 2: When input = 16 , Output = 0, 16,16
I'm not getting the logic to complete the same. Can someone help me in this?
Regards
I've an incomplete c++ code give as below:
Code C++ - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #include <iostream> using namespace std; class sample { int x; public: sample():x(0) {} sample(int x):x(x) {} sample(const sample &obj): x(obj.x) {} void display() {cout << x << " ";} }; int main() { int val; cin >> val; ...................... ; //Default construcor ...................... ; //Non-default Constructor ...................... ; //Copy-Constructor objA.display(); objB.display(); objC.display(); return 0; }
1) Case 1: When input = 25 , Output = 0 , 25 , 25
2) Case 2: When input = 16 , Output = 0, 16,16
I'm not getting the logic to complete the same. Can someone help me in this?
Regards