Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // sdizo1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include "time.h"
- #include <string>
- #include <fstream>
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- struct dane
- {;
- /* wartosc losowa 1-10 000 */ int liczba;
- /* losowa litera od A do Z */ char litera;
- /*100 + numer kolejny struktury (1-N */ float nr;
- };
- void losowanie()
- {
- fstream plik;
- plik.open("C:\\Users\\Aga\\Desktop\\SDiZO\\lab1\\inlab01.txt", ios::in);
- int N;
- plik >> N;
- int *tablica = new int[N];
- for (int i = 0; i < N; i++)
- {
- dane zestaw;
- zestaw.liczba = 1 + (rand() % (int)(10000 - 1 + 1));
- zestaw.litera = 1 + (rand() % (char)('Z' - 'A' + 1));
- zestaw.nr = 100 + (float)i;
- dane* wsk_zes;
- wsk_zes = &zestaw;
- //cout << "&zestaw to " << &zestaw << endl;
- //cout << "&zestaw.liczba to " << &zestaw.liczba << endl;
- //cout << "wsk_zes to " << wsk_zes << endl;
- tablica[i] = &zestaw; //:(
- cout << "wartosc tablicy: " << tablica[i] << endl;
- }
- delete[] tablica;
- }
- void kasowanie()
- {
- }
- int main()
- {
- char X = 'G';
- losowanie();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement