Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct contacto {
  6. char nombre[30];
  7. char apellido[30];
  8. char numtelf[11];
  9. } cont[100];
  10.  
  11.  
  12. int pant_principal(int n);
  13.  
  14. void pedirdatos(int n) {
  15. cout<<"digame el nombre del contacto -> ";
  16. cin.getline(cont[n].nombre,30,'\n');
  17. cin.ignore();
  18. cout<<"digame el apellido del contacto -> ";
  19. cin.getline(cont[n].apellido,30,'\n');
  20. cin.ignore();
  21. cout<<"digame el numero del contacto -> ";
  22. cin.getline(cont[n].numtelf,11); cin.ignore();
  23.  
  24. // pant_principal(n+1);
  25. }
  26.  
  27. void mostrardatos(contacto cont[], int n){
  28. cout<<"======================================================"<<endl;
  29. cout<<" CONTACTOS"<<endl;
  30. cout<<"======================================================"<<endl;
  31.  
  32. cout<<endl;
  33. cout<<"Nombre: "<<cont[n].nombre<<endl;
  34. cout<<"Apellido: "<<cont[n].apellido<<endl;
  35. cout<<"Numero de Telefono: "<<cont[n].numtelf<<endl;
  36. }
  37.  
  38. int main() {
  39. int n=0;
  40. n=pant_principal(n);
  41.  
  42. return 0;
  43. }
  44.  
  45. int pant_principal( int n){
  46. int eleccion;
  47.  
  48. cout<<"======================================================"<<endl;
  49. cout<<" BIENVENIDO A TU AGENDA"<<endl;
  50. cout<<"======================================================"<<endl;
  51. cout<<endl;
  52.  
  53. cout<<"[1] - visitar agenda"<<endl;
  54. cout<<"[2] - agregar contacto"<<endl;
  55. cin>>eleccion;
  56.  
  57. switch(eleccion){
  58. case 1:
  59. mostrardatos(cont,n);
  60. break;
  61.  
  62. case 2: pedirdatos(n);
  63. n+=1;
  64. break;
  65.  
  66. default: break;
  67. }
  68.  
  69. return n;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement