GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — CPP-Tutorial/08_Simple_Calculator_Using_switch.cpp at main · i2a-k/CPP-Tutorial Expand file tree/ Copy path08_Simple_Calculator_Using_switch.cppMore file actions 30 lines (23 loc) · 595 Bytes / Copy path08_Simple_Calculator_Using_switch.cppFile metadata and controls30 lines (23 loc) · 595 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 #include <iostream> using namespace std; //Example: A simple CALCULATOR using switch statements int main(){ int num1, num2, op; cout <<"Enter first number: "; cin >> num1; cout <<"Enter second number: "; cin >> num2; cout <<"Specify the desired operation: 1(+) 2(-) 3(/) 4(*): "; cin >> op; switch(op){ case 1: cout<< num1 + num2; break; case 2: cout<< num1 - num2; break; case 3: cout << num1 / num2; break; case 4: cout << num1 * num2; break; default: cout<<"Invalid operation! \n"; } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |