elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


  Mostrar Mensajes
Páginas: [1]
1  Programación / Programación C/C++ / Ayuda en estructuras como funcion en: 30 Mayo 2012, 19:01 pm
hola soy novato en programacion estudiante de ing ssitemas 

Código
  1. [font=Verdana]#include "conio.h"
  2. #include "string.h"
  3. #include "stdlib.h"
  4. #include "stdio.h"
  5. #include "iostream"
  6. #define t 2
  7. #define max 10
  8. using namespace std;
  9. struct cliente
  10. {
  11.  char nombre[15];
  12.  char ape[15];
  13.  int dni;
  14.  float dinero;
  15.  int edad;
  16.  char telefono[10];
  17. }persona[t];
  18.  
  19. //--------------Funciones prototipo-----------
  20. void mostrar(struct cliente x[t]);
  21. int Registrarse();
  22. void Entrar(struct cliente x[t]);
  23. int Salir();
  24. //------------------------------------------------
  25. int Registrarse()
  26. {
  27.     int N;
  28.    do
  29.    {
  30.        cout << "Cuantas Personas va ha registrar ?: ";
  31.        cin >>N;
  32.    }while (N>max);
  33.    for (int i=0;i<N;i++)
  34.    {
  35.        cout<<"\nCLIENTE "<<i+1;
  36.        cout<< "\nDATOS PERSONALES:";
  37.        cout<<"\n_______________________"<<endl;
  38.        cout<< "\n\tIngrese nombre: ";
  39.        cin>>persona[i].nombre;
  40.        cout<<"\tApellido :";
  41.        cin>>persona[i].ape;
  42.        cout<<"\tDNI :" ;
  43.        cin>>persona[i].dni;
  44.        cout<<"\tEdad: ";
  45.        cin>>persona[i].edad;
  46.        cout<<"\tTelefono: ";
  47.        cin>>persona[i].telefono;
  48.        cout<<"\tCon cuanto va a aperturar su cuenta ? : ";
  49.        cin>>persona[i].dinero;
  50.        cout<<"\n_______________________"<<endl;
  51.    }
  52.    mostrar(persona);
  53.    getch();
  54. }
  55.  
  56. void mostrar(struct cliente x[t])
  57. {
  58.    for(int i=0;i<t;i++)
  59.        {
  60.            cout<<"\n\n"<<x[i].nombre<<" "<<x[i].ape<<" "<<x[i].dni<<" "<<x[i].edad<<"  "<<x[i].telefono;
  61.            cout<<"\n su saldo es :"<<x[i].dinero;
  62.        }
  63. }
  64. void Entrar(struct cliente x[t])
  65. {
  66.    int coincidencias,n;
  67.    int b_dni;
  68.    cout<<"\n\t Sr. CLIENTE ";
  69.    cout<<"\n* Ingrese su n° DNI: ";
  70.    cin>>b_dni;
  71.    //coincidencias = Buscar_dni(b_dni);
  72.    for(int i=0;i<t;i++)
  73.    {
  74.       // n=strcmp(b_dni, x[i].dni);
  75.       if(b_dni==x[i].dni)
  76.        {
  77.        coincidencias++;
  78.              cout<<"\n\n"<<x[i].nombre<<" "<<x[i].ape<<" "<<x[i].dni<<" "<<x[i].edad<<"  "<<x[i].telefono;
  79.            cout<<"\n su saldo es :"<<x[i].dinero;
  80.        }
  81.    }
  82.    if(coincidencias > 0)
  83. {
  84.        cout<<"\nHubo "<<coincidencias<<" coincidencias.\n"<<endl;
  85. }
  86. else
  87. {
  88.        cout<<"No se encuentra"<<endl;
  89. }
  90. }
  91.  
  92. int Salir()
  93. {
  94. getch();
  95. }
  96. main()
  97. {
  98.     int op1;
  99.    //do
  100.    //{
  101.    cout<<"1.- Registrarse\n2.- Entrar\n3.-Salir";
  102.    do
  103.    {
  104.        cout<<"\n\ningrese opcion :";
  105.        cin>>op1;
  106.    }while (op1<1 || op1>2);
  107.  
  108.    switch(op1)
  109.    {
  110.        case 1 : Registrarse();break;
  111.        case 2: Entrar();break;
  112.        case 3:Salir();
  113.        default:/* menu1();*/break;
  114.    }
  115.    //}while(op1!='2');
  116.    //Registrarse();
  117. }
  118. [/font]
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines