Posts

Showing posts with the label calculator

Calculator - Output of division, addition, substraction and multiplication of two given numbers.

ap3g #include <iostream> using namespace std ; //decimal output ke leye calculator jo sab sath mein hora(float). :D int main (){       float a , b ;       cout << "Input two numbers: " ;       cin >> a >> b ;       cout << "Output of division, addition, substraction and multiplication of two given numbers: " << endl ;       char op ;                               //if(op = '/'){             float div = a / b ;             cout << "a " << "/" << " b = " << div << endl ;          //}           //if(op = '+'){               float add = a + b ;               cout << "a " << "+" ...

Implement a single calculator using switch.

  ap3f #include <iostream> using namespace std ; //implement a single calculator using switch. int main (){     int n1 , n2 ;     cout << "Input two numbers: " ;     cin >> n1 >> n2 ;     char op ;     cout << "Input an operator: " ;     cin >> op ;     switch ( op ){         case '+' :         cout << n1 + n2 << endl ;         break ;         case '-' :         cout << n1 - n2 << endl ;         break ;         case '*' :         cout << n1 * n2 << endl ;         break ;         case '/' :         cout << n1 / n2 << endl ;         break ;         default ...