Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- int main()
- {
- srand (time(NULL));
- ofstream gen;
- gen.open ("brojevi.txt");
- for (int i = 0; i < 50; i++)
- {
- gen << rand () % 899999 + 100000;
- gen << " ";
- }
- return 0;
- }
- /////////////////////////////////////////////////////////////////////
- int main()
- {
- ifstream ulaz;
- ulaz.open("kljucevi.dat");
- int polje[100];
- int i = 0;
- while(ulaz >> polje[i])
- i++;
- for(int i=0; i<50; i++)
- cout<<polje[i]<<endl;
- return 0;
- }
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- int main()
- {
- int kljuc[50];
- ofstream izlaz;
- izlaz.open("kljucevi.dat");
- for(int i=0; i<50; i++)
- {
- kljuc[i]=rand() % 999999 + 100000;
- izlaz<<kljuc[i]<<" ";
- }
- }
- -------------------------------------------------------------------------
- #include <iostream>
- #include <fstream>
- using namespace std;
- int a[100];
- int main()
- {
- ifstream ul;
- ul.open("brojevi.txt");
- for (int i = 0; i < 50; i++ )
- {
- ul >> a[i];
- cout << a[i];
- cout << " ";
- }
- return 0;
- }
- ------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement