KarolWozniak

Operacje zadanie 1

May 21st, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4. #include <fstream>
  5.  
  6. using namespace std;
  7. int a=1,b=30,c;
  8.  
  9. int main()
  10. {
  11.     srand(time(NULL));
  12.     ofstream zapis_do_pliku ("liczby.txt");
  13.     for(int i=1; i<=10; i++)
  14.     {
  15.         c=a+rand()%(b-a+1);
  16.         cout << c << " ";
  17.         zapis_do_pliku<<c<<" ";
  18.     }
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment