fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6.  
  7. {
  8.  
  9. char znak;
  10. int a,b,ile;
  11.  
  12. cin >> ile ;
  13.  
  14. for (int i=1; i<=ile; i++)
  15.  
  16.  
  17. {
  18.  
  19. cin >> znak >> a >> b;
  20.  
  21. if (znak=='+')
  22. cout << a+b<< endl;
  23.  
  24. else if (znak=='-')
  25. cout<< a-b<<endl;
  26.  
  27. else if (znak=='/')
  28. {
  29. if (a||b==0)
  30. cout << "nie dzieli sie przez zero"<<endl;
  31. else
  32. cout<< a/b<<endl;
  33. }
  34.  
  35. else if (znak=='*')
  36. cout<< a*b << endl;
  37.  
  38. else if (znak=='%')
  39. cout<< a%b << endl;
  40.  
  41.  
  42. }
  43.  
  44. return 0;
  45. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty