Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <climits>
- #include <cmath>
- using namespace std;
- int main()
- {
- char yn;
- do
- {
- yn = ' ';
- short b;
- cout << "enter short b" << endl;
- cin >> b;
- short a;
- cout << "\nenter short a" << endl;
- cin >> a;
- cout << "\n\n " << a+b << " is the answer" << endl;
- cout << "\nWould you like to translate another number?(y/n)" << endl;
- cin >> yn;
- while (isdigit(yn))
- {
- cout << "\nYou've entered a number, please enter the character 'y' or the character 'n' on your keyboard!" << endl;
- cin >> yn;
- }
- yn = tolower(yn);
- cin.clear();
- cin.ignore(INT_MAX,'\n');
- } while (yn == 'y');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement