Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char go = 'y';
- int choice = 0;
- while (go == 'y' || go == 'Y')
- {
- // do the tasks
- cout << "Enter 1 to calculate the area of a square" << endl;
- cout << "Enter 2 to calculate the area of a triangle" << endl;
- cin >> choice;
- if (choice == 1)
- {
- // calculate square
- cout << "Square" << endl;
- }
- else
- {
- // calculate triangle
- cout << "Triangle" << endl;
- }
- cout << "Do you want to continue? (y or n)" << endl;
- cin >> go;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment