Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main();
- class Calculators;
- {
- private:
- long calculateLargeAnswer(){
- long h;
- long j;
- char a;
- long answerL = h + j;
- cout << "The sum of your numbers is " << answerL << ". \n";
- cout << "Continue calculations? (Y/N)";
- cin >> a;
- if (a == 'Y')
- main();
- if (a == 'N')
- return 0;
- }
- public:
- long calculateLarge(){
- long h;
- long j;
- cout << "Please enter a number. \n";
- cin >> h;
- cout << "Enter another number. \n";
- cin >> j;
- calculateLargeAnswer();
- }
- private:
- int calculateSmallAnswer(){
- int x;
- int y;
- char d;
- int answer = x + y;
- cout << "The sum of your numbers is " << answer << ". \n";
- cout << "Would you like to continue calculations? (Y/N) \n";
- cin >> d;
- if(d == 'Y')
- main();
- if(d == 'N')
- return 0;
- }
- public:
- int calculateSmall(){
- int x;
- int y;
- cout << "Please enter a number. \n";
- cin >> x;
- cout << "Enter another number. \n";
- cin >> y;
- calculateSmallAnswer();
- }
- }
- int main(){
- Calculators calcChoice;
- int g;
- cout << "1. Large Calculation \n";
- cout << "2. Small Calculation \n";
- cin >> g;
- if (g == '1');
- calcChoice.calculateLarge();
- if (g == '2');
- calcChoice.calculateSmall();}
Add Comment
Please, Sign In to add comment