Advertisement
omegapharma

Untitled

Feb 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <cstdlib>
  3. #include <iostream>
  4. #include <ctime>
  5. #include <string>
  6.  
  7. using namespace std;
  8.  
  9. int main(void) {
  10. setlocale(LC_ALL, "");
  11. int epsilon, los, liczba;
  12.  
  13. cout << "Podaj liczbę:" << endl;
  14. cin >> liczba;
  15. cout << "Podaj epsilon" << endl;
  16. cin >> epsilon;
  17.  
  18. srand(time(NULL));
  19. los = rand();
  20.  
  21. if ((los + epsilon) < liczba) cout << "liczba za duża";
  22. else if ((los - epsilon) > liczba) cout << "liczba za mała";
  23. else cout << "trafiłeś, to jest ta liczba w granicach błędu";
  24.  
  25. system("pause");
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement