prac_003.cpp ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 22 Jun 2026
- License — MIT
Problem Statement ​
Problem Statement
Addition of two inputs
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
cpp
#include <iostream>
using namespace std;
class addoftwoinput {
int inp1, inp2, out;
public:
void input();
void calculation();
void output();
};
void addoftwoinput ::input() {
cout << "\nInsert the 1st number : ";
cin >> inp1;
cout << "\nInsert the 2nd number : ";
cin >> inp2;
}
void addoftwoinput ::calculation() {
out = inp1 + inp2;
}
void addoftwoinput ::output() {
cout << "\nSum of " << inp1 << " and " << inp2 << " is : " << out;
}
int main() {
addoftwoinput z;
z.input();
z.calculation();
z.output();
return 0;
}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
26
27
28
29
30
31
32
33
34
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34