Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <stdlib.h>
  4. #include <time.h>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. srand (time(NULL));
  11. ofstream gen;
  12. gen.open ("brojevi.txt");
  13. for (int i = 0; i < 50; i++)
  14. {
  15. gen << rand () % 899999 + 100000;
  16. gen << " ";
  17. }
  18. return 0;
  19. }
  20.  
  21. /////////////////////////////////////////////////////////////////////
  22. int main()
  23. {
  24. ifstream ulaz;
  25. ulaz.open("kljucevi.dat");
  26.  
  27. int polje[100];
  28. int i = 0;
  29. while(ulaz >> polje[i])
  30. i++;
  31.  
  32. for(int i=0; i<50; i++)
  33. cout<<polje[i]<<endl;
  34.  
  35. return 0;
  36. }
  37. #include <iostream>
  38. #include <fstream>
  39. #include <iomanip>
  40. #include <stdlib.h>
  41. #include <time.h>
  42.  
  43. using namespace std;
  44.  
  45. int main()
  46. {
  47. int kljuc[50];
  48. ofstream izlaz;
  49. izlaz.open("kljucevi.dat");
  50.  
  51. for(int i=0; i<50; i++)
  52. {
  53. kljuc[i]=rand() % 999999 + 100000;
  54.  
  55. izlaz<<kljuc[i]<<" ";
  56. }
  57. }
  58.  
  59. -------------------------------------------------------------------------
  60.  
  61. #include <iostream>
  62. #include <fstream>
  63.  
  64. using namespace std;
  65.  
  66. int a[100];
  67.  
  68. int main()
  69. {
  70. ifstream ul;
  71. ul.open("brojevi.txt");
  72.  
  73. for (int i = 0; i < 50; i++ )
  74. {
  75. ul >> a[i];
  76. cout << a[i];
  77. cout << " ";
  78. }
  79. return 0;
  80. }
  81.  
  82.  
  83. ------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement