LeventHAN

Untitled

Oct 5th, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.98 KB | None | 0 0
  1. /*
  2.     Huh this fucked me up... :(
  3. */
  4.  
  5.  
  6. #include <stdio.h>
  7.  
  8. int main(void)
  9. {
  10.     getal1 = getw;
  11.     operand =
  12.     getal2 =
  13.    
  14.     char a;
  15.     printf("Enter an expression (without spaces!): \n");
  16.     scanf("%f%c%f%*c",&getal1,&operand,&getal2);
  17.     printf("%f%c%f%*c",&getal1,&operand,&getal2);
  18.    
  19.     switch (operator)
  20.     {
  21.         case '+':
  22.             cout << getal1 << " + " << getal2 << " = " << getal1+getal2;
  23.             break;
  24.         case '-':
  25.             cout << getal1 << " - " << getal2 << " = " << getal1-getal2;
  26.             break;
  27.         case '*':
  28.             cout << getal1 << " * " << getal2 << " = " << getal1*getal2;
  29.             break;
  30.         case '/':
  31.             cout << getal1 << " / " << getal2 << " = " << getal1/getal2;
  32.             break;
  33.         default:
  34.             // operator is doesn't match any case constant (+, -, *, /)
  35.             cout << "Error! operator is not correct";
  36.             break;
  37.     }
  38.    
  39.    
  40.    
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment