Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main ()
- {
- bool done = false;
- do { //loops program
- begin_cycle:;
- int a, b;
- string opr;
- cout << "First Number: ";
- cin >> a;
- cout << "Second Number: ";
- cin >> b;
- begin_cycle2:;
- cout << "Operator?[a][s][m][d]: ";
- cin >> opr;
- if ( opr == "a" )
- {
- int r;
- r=a+b;
- cout << "Result: " << r << "\n";
- goto begin_cycle;
- }
- else if ( opr == "s" )
- {
- int r;
- r=a-b;
- cout << "Result: " << r << "\n";
- goto begin_cycle;
- }
- else if (opr == "m" )
- {
- int r;
- r=a*b;
- cout << "Result: " << r << "\n";
- goto begin_cycle;
- }
- else if ( opr == "d" )
- {
- int r;
- r=a/b;
- cout << "Result: " << r << "\n";
- goto begin_cycle;
- }
- else if ( opr == "stop" )
- {
- goto end_cycle;
- }
- else
- {
- cout << opr << "is not an operator." << endl;
- goto begin_cycle2;
- }
- } while (!done);
- end_cycle:;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement