Advertisement
Guest User

Untitled

a guest
Jun 7th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool sprawdz(int bufor_, int liczba_)
  6. {
  7. if (bufor_ != 42 && liczba_ == 42)
  8. return true;
  9. else false;
  10. }
  11.  
  12. int main()
  13. {
  14. int licznik = 0, liczba, bufor;
  15.  
  16. //cout << "Podaj liczby:\n";
  17. cin >> liczba;
  18. bufor = liczba;
  19. if (sprawdz(bufor, liczba) == true)
  20. ++licznik;
  21. cout << liczba << endl;
  22.  
  23. while (licznik < 3)
  24. {
  25. cin >> liczba;
  26. cout << liczba << endl;
  27. if (sprawdz(bufor, liczba) == true)
  28. ++licznik;
  29. bufor = liczba;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement