Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- struct Address {
- char street[50];
- char city[50];
- char number[10];
- char county[50];
- };
- struct Person {
- char name[50];
- int age;
- char cnp[14];
- Address address;
- };
- int main() {
- int numberOfPeople;
- cout << "Cate persoane vrei sa citesti: " << endl;
- cin >> numberOfPeople;
- struct Person people[numberOfPeople];
- for(int i = 0; i < numberOfPeople; i++) {
- cout << "Enter name: ";
- cin >> people[i].name;
- cout << "Enter age: ";
- cin >> people[i].age;
- cout << "Enter cnp: ";
- cin >> people[i].cnp;
- cout << "Enter address: ";
- cout << "Enter the Street: " << endl;
- cin >> people[i].address.street;
- cout << "Enter the City: ";
- cin >> people[i].address.city;
- cout << "Enter the number: ";
- cin >> people[i].address.number;
- cout << "Enter the county: ";
- cin >> people[i].address.county;
- }
- for(int i = 0; i < numberOfPeople; i++) {
- cout << "name: " << people[i].name << endl;
- cout << "Age: " << people[i].age << endl;
- cout << "Cnp: "<< people[i].cnp << endl;
- cout << "Address: ";
- cout << "Street: " << people[i].address.street << endl;
- cout << "City: " << people[i].address.city << endl;
- cout << "Number: " << people[i].address.number << endl;
- cout << "County: " << people[i].address.county << endl;
- cout << "-----------" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment