Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <fstream>
- using namespace std;
- int main()
- {
- ofstream plik("plik.txt");
- int x;
- srand(time(NULL));
- if(plik.is_open())
- {
- for(int i=0; i<10; i++)
- {
- x = rand()%30+1;
- plik << x;
- plik << endl;
- }
- cout << "Zapis udany.";
- }
- else
- {
- cout << "Blad zapisu. Konczenie programu.";
- }
- plik.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement