Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Huh this fucked me up... :(
- */
- #include <stdio.h>
- int main(void)
- {
- getal1 = getw;
- operand =
- getal2 =
- char a;
- printf("Enter an expression (without spaces!): \n");
- scanf("%f%c%f%*c",&getal1,&operand,&getal2);
- printf("%f%c%f%*c",&getal1,&operand,&getal2);
- switch (operator)
- {
- case '+':
- cout << getal1 << " + " << getal2 << " = " << getal1+getal2;
- break;
- case '-':
- cout << getal1 << " - " << getal2 << " = " << getal1-getal2;
- break;
- case '*':
- cout << getal1 << " * " << getal2 << " = " << getal1*getal2;
- break;
- case '/':
- cout << getal1 << " / " << getal2 << " = " << getal1/getal2;
- break;
- default:
- // operator is doesn't match any case constant (+, -, *, /)
- cout << "Error! operator is not correct";
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment