Advertisement
Mauriciocaradenepe

viernes

Jun 15th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. // ConsoleApplication2.cpp : main project file.
  2.  
  3. #include <iostream>
  4. #include <conio.h>
  5.  
  6. using namespace System;
  7. using namespace std;
  8.  
  9. struct Persona
  10. {
  11. char nombre[20];
  12. int dni;
  13. };
  14. struct Perro
  15. {
  16. char nombre[10];
  17. char raza[20];
  18. int edad;
  19. Persona dueño;
  20. };
  21.  
  22. void Leer(Perro * x)
  23. {
  24. for (int i = 0; i < 2; i++)
  25. {
  26. cout << "Ingrese nombre"; cin >> x[i].nombre;
  27. cout << "Ingrese raza"; cin >> x[i].raza;
  28. cout << "Ingrese edad"; cin >> x[i].edad;
  29. cout << "Ingrese nombre dueño"; cin >> x[i].dueño.nombre;
  30. cout << "Ingrese dni dueño"; cin >> x[i].dueño.dni;
  31. }
  32. }
  33. void Imprimir(Perro * x)
  34. {
  35. for (int i = 0; i < 2; i++)
  36. cout << x[i].nombre << " "
  37. << x[i].raza << " "
  38. << x[i].edad << " "
  39. << x[i].dueño.nombre << endl;
  40. }
  41. int main()
  42. {
  43. Perro * Aperros = new Perro[2];
  44. Leer(Aperros);
  45. Imprimir(Aperros);
  46. _getch();
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement