Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <cstdio>
- #include <ctime>
- using namespace std;
- int main()
- {
- FILE *plik;
- srand(time(0));
- try{
- if((plik=fopen("zapis.txt", "a")) == 0){
- throw 1234567;
- }
- else{
- int liczba = rand();
- fprintf(plik, "%i\n", liczba);
- cout << "Zapisano: " << liczba << endl;
- }
- }
- catch(int x){
- cout << "Nie otwarto pliku" << endl;
- cout << "no i koniec: " << x;
- }
- fclose(plik);
- //sussy
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement