bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / practice / prac_003.cpp

prac_003.cpp (616B)


      1 /* Addition of two inputs */
      2 
      3 #include <iostream>
      4 using namespace std;
      5 
      6 class addoftwoinput {
      7     int inp1, inp2, out;
      8 
      9 public:
     10     void input();
     11     void calculation();
     12     void output();
     13 };
     14 
     15 void addoftwoinput ::input() {
     16     cout << "\nInsert the 1st number : ";
     17     cin >> inp1;
     18     cout << "\nInsert the 2nd number : ";
     19     cin >> inp2;
     20 }
     21 
     22 void addoftwoinput ::calculation() {
     23     out = inp1 + inp2;
     24 }
     25 
     26 void addoftwoinput ::output() {
     27     cout << "\nSum of " << inp1 << " and " << inp2 << " is : " << out;
     28 }
     29 
     30 int main() {
     31     addoftwoinput z;
     32     z.input();
     33     z.calculation();
     34     z.output();
     35     return 0;
     36 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror