Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication2.cpp : main project file.
- #include <iostream>
- #include <conio.h>
- using namespace System;
- using namespace std;
- struct Persona
- {
- char nombre[20];
- int dni;
- };
- struct Perro
- {
- char nombre[10];
- char raza[20];
- int edad;
- Persona dueño;
- };
- void Leer(Perro * x)
- {
- for (int i = 0; i < 2; i++)
- {
- cout << "Ingrese nombre"; cin >> x[i].nombre;
- cout << "Ingrese raza"; cin >> x[i].raza;
- cout << "Ingrese edad"; cin >> x[i].edad;
- cout << "Ingrese nombre dueño"; cin >> x[i].dueño.nombre;
- cout << "Ingrese dni dueño"; cin >> x[i].dueño.dni;
- }
- }
- void Imprimir(Perro * x)
- {
- for (int i = 0; i < 2; i++)
- cout << x[i].nombre << " "
- << x[i].raza << " "
- << x[i].edad << " "
- << x[i].dueño.nombre << endl;
- }
- int main()
- {
- Perro * Aperros = new Perro[2];
- Leer(Aperros);
- Imprimir(Aperros);
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement