Advertisement
Guest User

Untitled

a guest
Feb 14th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <cstdio>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. char operacja;
  9. int wynik, liczba1, liczba2;
  10.  
  11. printf("Podaj liczbe 1 = ");scanf("%d",&liczba1);
  12. printf("Podaj liczba 2 = ");scanf("%d",&liczba2);
  13. printf("Podaj opercje do wykonania [+,-,*,\\]");//scanf("%c",&operacja);
  14. //operacja = getchar();
  15. operacja=getch();
  16.  
  17. if (operacja == '+')
  18. wynik = liczba1 + liczba2;
  19. else
  20. if (operacja == '-')
  21. wynik = liczba1 - liczba2;
  22. else
  23. if (operacja =='*')
  24. wynik = liczba1 * liczba2;
  25. else
  26. wynik = liczba1 / liczba2;
  27. printf("\nWynik: %d%c%d=%d",liczba1,operacja,liczba2,wynik);
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement