+ 1

Built a simple calculater

using switch case property's

8th Dec 2017, 1:50 PM
kindu bante
2 Respuestas
+ 8
int main() {     char operation;     float num1,num2;     cout << "Enter operator either + or - or * or /: ";     cin >> operation;     cout << "Enter two operands: ";     cin >> num1 >> num2;     switch(operation) {         case '+':             cout << num1+num2;             break;         case '-':             cout << num1-num2;             break;         case '*':             cout << num1*num2;             break;         case '/':             cout << num1/num2;             break;         default:             /* If operator is other than +, -, * or /, error message is shown */             cout << "Error! operator is not correct";             break;     }     return 0; }
8th Dec 2017, 2:07 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 2
You forgot to post the link so we could check out your calculator. https://www.sololearn.com/Codes/
8th Dec 2017, 1:52 PM
AgentSmith