Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5. bool isRight();
  6.  
  7.  
  8.  
  9. int main()
  10. {
  11. int sum = 0;
  12. int sum2 = 0;
  13.  
  14. while(sum2<100)
  15. {
  16. do{
  17. cin >> sum;
  18. sum2 = sum2 + sum;
  19. }while(!isRight());
  20.  
  21. }
  22.  
  23. cout << "Twoja suma to: " << sum2 << endl;
  24.  
  25.  
  26.  
  27. return 0;
  28. }
  29.  
  30. bool isRight()
  31. {
  32. if(cin.rdstate())
  33. {
  34. cin.clear();
  35. cin.ignore(1024,'\n');
  36.  
  37. system("cls");
  38. cout << "Przestan podawac znaki. Podaj teraz same liczby:" << endl;
  39. return false;
  40. }
  41. return true;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement