Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. // sdizo1.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "time.h"
  6. #include <string>
  7. #include <fstream>
  8. #include <iostream>
  9. #include <cstdlib>
  10. using namespace std;
  11.  
  12. struct dane
  13. {;
  14. /* wartosc losowa 1-10 000 */ int liczba;
  15. /* losowa litera od A do Z */ char litera;
  16. /*100 + numer kolejny struktury (1-N */ float nr;
  17. };
  18.  
  19. void losowanie()
  20. {
  21. fstream plik;
  22. plik.open("C:\\Users\\Aga\\Desktop\\SDiZO\\lab1\\inlab01.txt", ios::in);
  23. int N;
  24. plik >> N;
  25. int *tablica = new int[N];
  26.  
  27. for (int i = 0; i < N; i++)
  28. {
  29. dane zestaw;
  30. zestaw.liczba = 1 + (rand() % (int)(10000 - 1 + 1));
  31. zestaw.litera = 1 + (rand() % (char)('Z' - 'A' + 1));
  32. zestaw.nr = 100 + (float)i;
  33.  
  34. dane* wsk_zes;
  35. wsk_zes = &zestaw;
  36.  
  37. //cout << "&zestaw to " << &zestaw << endl;
  38. //cout << "&zestaw.liczba to " << &zestaw.liczba << endl;
  39. //cout << "wsk_zes to " << wsk_zes << endl;
  40.  
  41.  
  42. tablica[i] = &zestaw; //:(
  43.  
  44. cout << "wartosc tablicy: " << tablica[i] << endl;
  45.  
  46. }
  47.  
  48. delete[] tablica;
  49. }
  50.  
  51. void kasowanie()
  52. {
  53.  
  54. }
  55.  
  56. int main()
  57. {
  58.  
  59. char X = 'G';
  60. losowanie();
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement