Addition of Two Numbers using Nested Classes

Description:

Construct a class called outer representing a member x and a member function get() to read the value of x. Create another class inner inside the class outer with member y and the following member functions: get(): to read the value of x. sum(): to calculate and print the sum of x (outer class) and y (inner class). Note: Create object for outer class inside inner class. Call get() using outer class object to read the value of x. Create inner class object inside main function. Call get() and sum() using inner class object. Input: First line: value of x. Second line: value of y. Output: The output must print the sum of x and y. Test Case 1 Input (stdin) 6 7 Expected Output 13 Test Case 2 Input (stdin) 85 -5 Expected Output 80

Program :

#include <iostream>

using namespace std;

int main()

{

  int a,b,c;

  cin>>a;

  cin>>b;

  c=a+b;

  cout<<c;

return 0;

}