Vous êtes sur la page 1sur 1

#include <iostream> #using namespace std void main() { double input1, input2, answer; int func; cout<<"Calculator"<<endl; cout<<\n"Enter

Digit: "; cin>> input1; cin>> input2; cout<<"Enter a(addition), s(subtraction), m(multiplication), d(division)"<<endl; cin>> func; if (func == 'a') { answer = input1 + input2; cout<< input1 <<" + " <<input2 } else if (func == 's') { answer = input1 - input2; cout<< input1 <<" - " <<input2 } else if (func == 'm') { answer = input1 * input2; cout<< input1 <<" * " <<input2 } else if (func == 'd') { answer = input1 / input2; cout<< input1 <<" / " <<input2 } else cout<<"Invalid Input"<<endl; }

<<"= " <<answer;

<<"= " <<answer;

<<"= " <<answer;

<<"= " <<answer;