Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <string>
- #include <fstream>
- int losowa = 0;
- using namespace std;
- int main()
- {
- fstream plik("liczby.txt", ios::out);
- srand(time(NULL));
- if (plik.good()==true)
- {
- for (int i=0; i<30; i++)
- {
- losowa = rand()%30+2;
- plik << losowa << endl;
- }
- cout << "Zapisywanie ukonczone!" << endl;
- }
- else
- {
- cout << "Brak dostepu do pliku!" << endl;
- exit(0);
- }
- plik.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement