This commit is contained in:
Mikołaj Rosa 2022-04-26 14:27:08 +02:00
parent c101429a03
commit 4d9daac7c5
1 changed files with 19 additions and 1 deletions

View File

@ -1,13 +1,31 @@
#include <iostream> #include <iostream>
#include <vector>
#include <random>
#include <string>
using namespace std; using namespace std;
struct Osoba { struct Osoba {
string imie; string imie;
string nazwisko; string nazwisko;
int wiek;
int pesel;
}; };
int main() int main()
{ {
vector<Osoba> osoby;
for (int i = 0; i < 10; i++) {
Osoba tmp;
tmp.imie = "Andrzej" + to_string(rand() % 100);
tmp.nazwisko = "Kowalski" + to_string(rand() % 100);
tmp.pesel = rand() % 500000 + 1000000;
tmp.wiek = rand() % 20 + 10;
osoby.push_back(tmp);
}
for (int i = 0; i < osoby.size(); i++) {
cout << i << ". " << osoby.at(i).imie << ' ' << osoby.at(i).nazwisko << ", wiek " << osoby.at(i).wiek << ", pesel " << osoby.at(i).pesel << endl;
}
} }