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

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Ayuda para resolver dos funciones
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ayuda para resolver dos funciones  (Leído 2,551 veces)
fupro

Desconectado Desconectado

Mensajes: 2


Ver Perfil
Ayuda para resolver dos funciones
« en: 8 Junio 2010, 15:36 pm »

muy buenas tardes... eespero q al leer este mensaje se encuentre muy bn .
lo sigueinte es q me mandaron a hacer un software para mi examen final el cual manejara toda la informacion de los clientes de una coorporacionde ahorros los cuales son crear dos archivos clientes y movimiento, reañizar aperturas de cuenta, modificar cleintes, eliminar clientes,realizar consignacion, reallizar retiros, listado general de clientes,consulta especifica de clientes y salir.
los registros q se guardan el el archivo clientes son numero de cuenta, nombre, cedula, tipo de cuenta,direccion del cliente telefonoy saldo.los registrso para el archivo movimiento son numero de cuenta, tipo de transaccion y monto. el numero de cuenta se maneja en los ados archivos movimiento y clientes. si se elimina una cuenta del archivo cleinte tambien debe borrarse en archivo movimeinto. si se realiza la consignacion esta debe guardarse en movimiento y actualizar en cliente. si retiro debe guardar en movimiento y actualizar en cleinte y no se puede retirar mas del saldo disponible.. lo unico q no eh dado para hacer  es el palnteamiento de consignar y retiro. necesit su asesoria exacta para plantearlos  gracias  

este es el programa q llevo hecho haste el momento

Código
  1. struct
  2. { char numcuenta[12];
  3.  char numced [10];
  4.  char nomcliente[50];
  5.  char tcuenta[12];
  6.  char direcliente[30];
  7.  char telcliente[12];
  8.  float saldo;
  9. }datos;
  10.  
  11. struct
  12. { char numcuenta[12];
  13.  char tipotran[12];
  14.  float monto;
  15. }movim;
  16.  
  17. //**************************************************************************
  18.  
  19. int id1,id2;
  20.  
  21. //****************************************************************************
  22.  
  23. void validar_crear1();
  24. void crear1();
  25. void validar_crear2();
  26. void crear2();
  27. void ingresar();
  28. void modificar();
  29. void modificar2(char auxc1[20],char auxc2[20]);
  30. void eliminar();
  31. void eliminar2(char auxc[20]);
  32. void consignar();
  33. void retirar();
  34. void listar();
  35. void consultar();
  36. void menu();
  37. int buscar(char datos[20]);
  38.  
  39. //**********************************************************************************
  40.  
  41. void main()
  42. { menu();
  43. }
  44.  
  45. //*************************************************************************************
  46.  
  47. void menu()
  48. { int op;
  49.  
  50. do
  51. { clrscr();
  52. gotoxy(23,5);printf("**<<<MENU PRINCIPAL>>>**");
  53. gotoxy(23,7);printf("1. CREAR ARCHIVO CLIENTES");
  54. gotoxy(23,8);printf("2. CREAR ARCHIVO MOVIMIENTOS");
  55. gotoxy(23,9);printf("3. REALIZAR APERTURA DE CUENTAS");
  56. gotoxy(23,11);printf("4. MODIFICAR DATOS DE CLIENTES");
  57. gotoxy(23,12);printf("5. ELIMINAR DATOS DE CLIENTES");
  58. gotoxy(23,13);printf("6. REALIZAR CONSIGNACIONES");
  59. gotoxy(23,14);printf("7. REALIZAR RETIROS");
  60. gotoxy(23,16);printf("8. LISTADO GENERAL DE CLIENTES");
  61. gotoxy(23,17);printf("9. CONSULTA ESPECIFICA DE CLIENTES");
  62. gotoxy(23,18);printf("10. SALIR DEL PROGRAMA");
  63. gotoxy(23,19);printf(" SELECCIONE OPCION DE [1-10]...");
  64. scanf("%d",&op);
  65. switch (op)
  66.  
  67. {
  68.  case 1:validar_crear1(); break;
  69.  case 2:validar_crear2(); break;
  70.  case 3:ingresar(); break;
  71.  case 4:modificar(); break;
  72.  case 5:eliminar(); break;
  73.  case 6:consignar(); break;
  74.  case 7:retirar(); break;
  75.  case 8:listar(); break;
  76.  case 9:consultar(); break;
  77.  case 10: exit(0); break;
  78.  default: gotoxy(22,22);
  79.  gotoxy (25,17); printf("opcion incorrecta...<ENTER>...para continuar..");
  80.  getch(); break;
  81.  }
  82. } while (op!=10);
  83. }
  84.  
  85. //*****************************************************************************************
  86.  void validar_crear1()
  87.  { char ct;
  88.  
  89.    id1=_open("c:\\clientes.txt",O_RDONLY);
  90.  
  91.    if (id1!=-1)
  92.    {gotoxy(25,18);printf("EL ARCHIVO CLIENTES YA EXISTE ");
  93.    gotoxy(25,19);printf(" DESEA CREARLO NUEVAMENTE[S/N]... ");
  94.    ct=toupper (getch());
  95.    if (ct=='S')
  96.    {crear1();
  97.    }
  98.   }
  99.   else
  100.   {crear1();
  101.   }
  102.  }
  103.  
  104. //********************************************************************************************************
  105.  
  106. void crear1()
  107. { id1=_creat("c:\\clientes.txt",0);
  108.  clrscr();
  109.  
  110.  if(id1==-1)
  111.  { gotoxy(28,18); printf(" IMPOSIBLE CREAR EL ARCHIVO CLIENTES...!");
  112.    getch();
  113.  }
  114.  else
  115.  { gotoxy(28,18); printf("EL ARCHIVO HA SIDO CREADO"); getch();
  116.    _close(id1);
  117.  }
  118. }
  119.  
  120. //*********************************************************************************************
  121.  
  122.  
  123.  void validar_crear2()
  124.  { char rp;
  125.  
  126.    id2=_open("c:\\movimientos.txt",O_RDONLY);
  127.  
  128.    if (id2!=-1)
  129.    {gotoxy(25,18);printf("EL ARCHIVO MOVIMIENTOS YA EXISTE ");
  130.    gotoxy(25,19);printf(" DESEA CREARLO NUEVAMENTE[S/N]... ");
  131.    rp=toupper (getch());
  132.    if (rp=='S')
  133.    {crearm();
  134.    }
  135.   }
  136.   else
  137.   {crear2();
  138.   }
  139.  }
  140.  
  141. //*****************************************************************************************************
  142.  
  143.  
  144. void crear2()
  145. { id2=_creat("c:\\movimientos.txt",0);
  146.   clrscr();
  147.  
  148.   if(id2==-1)
  149.   { gotoxy(28,18); printf(" IMPOSIBLE CREAR EL ARCHIVO MOVIMIENTOS...!");
  150.     getch();
  151.   }
  152.   else
  153.   { gotoxy(28,18); printf("EL ARCHIVO HA SIDO CREADO"); getch();
  154.    _close(id2);
  155.   }
  156.  }
  157.  
  158.  //*********************************************************************************************
  159.  
  160.  void ingresar()
  161.  
  162.  { char aux[20],sg='S';
  163.    int c,bytes;
  164.  
  165.    clrscr();
  166.  
  167.    id1=_open("c:\\clientes.txt",O_RDWR);
  168.    if(id1==-1)
  169.    { gotoxy(28,18); printf("IMPOSIBLE ABRIR EL ARCHIVO CLIENTES...!");
  170.    }
  171.    else
  172.    {while (sg=='S')
  173.     { clrscr();
  174.       gotoxy(29,5); printf("**INGRESAR CUENTAS**");
  175.       gotoxy(22,11); printf("-------------------");
  176.       gotoxy(22,10); printf("DIGITE EL NUMERO DE LA CUENTA...");
  177.       fflush(stdin); gets(aux);
  178.       c=buscar(aux);
  179.       if(c!=0)
  180.       {gotoxy(22,12); printf("EL NUMERO DE LA CUENTA YA EXISTE...!");
  181.       }
  182.       else
  183.       { strcpy(datos.numcuenta,aux);
  184. gotoxy(22,13); printf("----------------------");
  185. gotoxy(22,12); printf(" DIGITE EL NUMERO DE LA CEDULA...");
  186. gets(datos.numced);
  187. gotoxy(22,15); printf("----------------------");
  188. gotoxy(22,14); printf("DIGITE EL NOMBRE...");
  189. gets(datos.nomcliente);
  190.         gotoxy(22,17); printf("----------------------");
  191. gotoxy(22,16); printf("DIGITE EL TIPO DE CUENTA...");
  192. gets(datos.tcuenta);
  193. gotoxy(22,19); printf("----------------------");
  194. gotoxy(22,18); printf("DIGITE LA DIRECCION...");
  195.         gets(datos.direcliente);
  196. gotoxy(22,21); printf("----------------------");
  197. gotoxy(22,20); printf("DIGITE EL TELEFONO...");
  198. gets(datos.telcliente);
  199. gotoxy(22,23); printf("----------------------");
  200. gotoxy(22,22); printf("DIGITE EL SALDO...");
  201. scanf("%f",&datos.saldo);
  202. lseek (id1,0,SEEK_END);
  203. bytes=_write(id1,&datos,sizeof(datos));
  204. if(bytes==-1)
  205. { gotoxy(22,25); printf(" IMPOSIBLE GRABAR EL REGISTRO...!");
  206. }
  207. else
  208. { gotoxy(22,25); printf("REGISTROS ALMACENADOS");
  209. }
  210. }
  211. gotoxy(22,26); printf("DESEA AGREGAR MAS DATOS [S/N]...");
  212. sg=toupper(getch());
  213. }
  214. _close(id1);
  215. }
  216.       }    
  217.  
  218.  
  219. //*******************************************************************************************************
  220.  
  221.  
  222.  
  223.       void modificar()
  224.       { char aux1[20], aux2[20],sg='S';
  225. int c,bytes,op1;
  226.  
  227. id1=_open("c:\\clientes.txt",O_RDWR);
  228. if(id1==-1)
  229. {gotoxy(20,10);printf(" IMPOSIBLE ABRIR EL ARCHIVO CLIENTES...!");
  230. }
  231. else
  232. {while(sg=='S')
  233.  {clrscr();
  234.   gotoxy(10,4);printf(" DIGITE EL NUMERO DE LA CUENTA A MODIFICAR...");
  235.   fflush(stdin);gets(aux1);
  236.   c=buscar(aux1);
  237.   if(c==0)
  238.   {gotoxy(10,6);printf("EL NUMERO DE LA CUENTA A MODIFICAR NO EXISTE...!");
  239.   }
  240.   else
  241.   {gotoxy(10,7);printf("NUMERO DE CUENTA DEL CLIENTE...%s",datos.numcuenta);
  242.    gotoxy(10,7);printf("NOMBRE DEL CLIENTE...%s",datos.nomcliente);
  243.    gotoxy(10,8);printf("TIPO DE CUENTA...%s",datos.tcuenta);
  244.    gotoxy(10,9);printf("DIRECCION DEL CLIENTE...%s",datos.direcliente);
  245.    gotoxy(10,10);printf("TELEFONO DEL CLIENTE...%s",datos.telcliente);
  246.    gotoxy(10,11);printf("-----------------");
  247.            gotoxy(10,12);printf("1.NUMERO DE CUENTA DEL CLIENTE...");
  248.    gotoxy(10,13);printf("2.NOMBRE DEL CLIENTE...");
  249.    gotoxy(10,14);printf("3.TIPO DE CUENTA...");
  250.    gotoxy(10,15);printf("4.DIRECCION DEL CLIENTE...");
  251.    gotoxy(10,16);printf("5.TELEFONO DEL CLIENTE...");
  252.            gotoxy(10,17);printf("6.SALDO DEL CLIENTE...");
  253.    gotoxy(10,18);printf(" SELECCIONE LA OPCION A MODIFICAR DE [1-6]...");
  254.    scanf("%d",&op1);
  255.    switch(op1)
  256.    {case 1:gotoxy(10,15);printf("DIGITE EL NUMERO DE CUENTA ACTUAL:%s",datos.numcuenta);
  257.    gotoxy(10,16);printf(" DIGITE EL NUEVO NUMERO DE CUENTA...");
  258.    fflush(stdin);gets(aux2);
  259.    c=buscar(aux2);
  260.    if(c!=0)
  261.    {gotoxy(10,17);printf("EL NUMERO DE CUENTA YA EXISTE...!");
  262.    }
  263.    else
  264.    {c=buscar(aux1);
  265.     strcpy(datos.numcuenta,aux2);
  266.    }
  267.                    modificarm(aux1,aux2);
  268.    break;
  269.      case 2: gotoxy(10,15);printf("NOMBRE DEL CLIENTE...%s",datos.nomcliente);
  270.   gotoxy(10,16);printf(" DIGITE EL NUEVO NOMBRE...");
  271.   fflush(stdin); gets(datos.nomcliente);
  272.   break;
  273.  
  274.      case 3:gotoxy(10,15);printf("TIPO DE CUENTA...%s",datos.tcuenta);
  275.   gotoxy(10,16);printf("DIDITE SU NUEVO TIPO DE CUENTA...");
  276.   fflush(stdin); gets(datos.tcuenta);
  277.   break;
  278.  
  279.  
  280.              case 4:gotoxy(10,15);printf("DIRECCION DEL CLIENTE...%s",datos.direcliente);
  281.          gotoxy(10,16);printf(" DIGITE SU NUEVA DIRECCION...");
  282.    fflush(stdin); gets(datos.direcliente);
  283.  
  284.      case 5:gotoxy(10,15);printf("TELEFONO DEL CLIENTE...%s",datos.telcliente);
  285.           gotoxy(10,16);printf(" DIGITE SU NUEVO NUMERO DE TELEFONO...");
  286.     fflush(stdin); gets(datos.telcliente);
  287.  
  288.      case 6:gotoxy(10,15);printf("SALDO DEL CLIENTE...%s",datos.saldo);
  289.                     gotoxy(10,16);printf(" DIGITE EL NUEVO SALDO...");
  290.     fflush(stdin);printf("%f",datos.saldo);
  291.                     break;
  292.  
  293.              default: gotoxy(10,15);printf("OPCION ERRADA...!");
  294.     op1=0;
  295.     break;
  296.    }
  297.  
  298.    if(op1!=0)
  299.    {bytes=_write(id1,&datos,sizeof(datos));
  300.              if(bytes==-1)
  301.     {gotoxy(10,19);printf("IMPOSIBLE MODIFICAR EL ARCHIVO...!");
  302.     }
  303.     else
  304.              {gotoxy(10,19);printf("DATOS MODIFICADOS...!");
  305.      }
  306.     }
  307.    }
  308.   gotoxy(10,20);printf("DESEA MODIFICAR MAS DATOS[S/N]...");
  309.   sg=toupper(getch());
  310.   }
  311.  }
  312.  _close(id1);
  313.  }
  314.  
  315.  
  316.  
  317.   //*******************************************************************************************************
  318.  
  319.     void modificar2(char auxc1[20], char auxc2[20])
  320.     {
  321. int bytes1,bytes2;
  322.  
  323. id2=_open("c:\\movimientos.txt",O_RDWR);
  324.  
  325. if(id2==-1)
  326. { gotoxy(20,10);printf("IMPOSIBLE ABRIR EL ARCHIVO MOVIMIENTOS...!");
  327. }
  328. else
  329. { while (!eof(id2))
  330.  { bytes1=_read(id2,&movim,sizeof(movim));
  331.            if(bytes1==-1)
  332.    { gotoxy(10,9);printf("IMPOSIBLE LEER EL ARCHIVO MOVIMIENTOS...!");
  333.      exit(1);
  334.    }
  335.    else
  336.            { if(strcmp(auxc1,movim.numcuenta)==0)
  337.      { strcpy(movim.numcuenta,auxc2);
  338.        bytes2=_write(id2,&movim,sizeof(movim));
  339.        if(bytes2==-1)
  340.        { gotoxy(10,19);printf("IMPOSIBLE MODIFICAR EL ARCHIVO MOVIMIENTOS...!");
  341.        }
  342.      }
  343.    }
  344.          }
  345.       }
  346. _close(id2);
  347.      }
  348.     //***********************************************************************************************
  349.  
  350.  
  351.     void eliminar()
  352.     { char aux[20],sg='S';
  353.       int x,bytes1,bytes2,id3;
  354.  
  355.       while (sg=='S')
  356.       { clrscr();
  357. id1=_open("c:\\clientes.txt",O_RDWR);
  358. if(id1==-1)
  359. {gotoxy(20,10);printf(" IMPOSIBLE ABRIR EL ARCHIVO CLIENTES...!");
  360. }
  361.  
  362. else
  363. {gotoxy(10,10);printf(" DIGITE EL NUMERO DE LA CUENTA A ELIMINAR...");
  364.  fflush(stdin);gets(aux);
  365.  x=buscar(aux);
  366.  if(x==0)
  367.  {gotoxy(10,11);printf("EL NUMERO DE LA CUENTA A ELIMINAR NO EXISTE...!");
  368.  }
  369.  else
  370.  {gotoxy(10,11);printf("NUMERO DE LA CEDULA...%s",datos.numced);
  371.   gotoxy(10,12);printf("NOMBRE DEL CLIENTE...%s",datos.nomcliente);
  372.   gotoxy(10,13);printf("TIPO DE CUENTA...%s",datos.tcuenta);
  373.   gotoxy(10,14);printf("DIRECCION DEL CLIENTE...%s",datos.direcliente);
  374.   gotoxy(10,15);printf("TELEFONO DEL CLIENTE...%s",datos.telcliente);
  375.   gotoxy(10,16);printf("SALDO DEL CLIENTE...%f",datos.saldo);
  376.    id3=_creat("c:\\auxi.txt",0);
  377.    if(id3==-1)
  378.    {clrscr();
  379.     gotoxy(10,11);printf(" IMPOSIBLE ABRIR EL ARCHIVO AUXILIAR CLIENTES...!");
  380.     getch();
  381.     }
  382.     else
  383.     {_close(id3);
  384.     }
  385.  
  386.     id3=_open("c:\\auxi.txt",O_RDWR);
  387.     lseek(id1,0,SEEK_SET);
  388.     while(!eof(id1))
  389.     { bytes1=_read(id1,&datos,sizeof(datos));
  390.              if(bytes1==-1)
  391.             {gotoxy(10,9);printf(" IMPOSIBLE LEER EL ARCHIVO CLIENTES..!");
  392.      exit(1);
  393.      }
  394.      else
  395.      {if(strcmp(datos.numcuenta,aux)!=0)
  396.       { bytes2=_write(id3,&datos,sizeof(datos));
  397.         if(bytes2==-1)
  398. { gotoxy(10,11);printf("IMPOSIBLE GRABAR EL ARCHIVO CLIENTES");
  399.         }
  400.            }
  401.           }
  402.  }
  403.  _close(id3);
  404.  _close(id1);
  405.  unlink("c:\\clientes.txt");
  406.  rename("c:\\auxi.txt","c:\\clientes.txt");
  407.  }
  408. }
  409. gotoxy(10,15);printf("DESEA ELIMINAR MAS DATOS[S/N]...");
  410. sg=toupper(getch());
  411. }
  412. }
  413.     //***************************************************************************************
  414.  
  415.     void eliminar2(char auxc[20])
  416.     {
  417.       int x,bytes1,bytes2,id4;
  418.  
  419.       id2=_open("c:\\movimientos.txt",O_RDWR);
  420. if(id2==-1)
  421. { gotoxy(20,10);printf(" IMPOSIBLE ABRIR EL ARCHIVO MOVIMIENTOS...!");
  422. }
  423.         else
  424. { id4=_creat("c:\\auxi2.txt",0);
  425.   if(id4==-1)
  426.   { clrscr();
  427.     gotoxy(10,11);printf(" IMPOSIBLE ABRIR EL ARCHIVO AUXILIAR MOVIMIENTOS...!");
  428.     getch();
  429.   }
  430.   else
  431.   { _close(id4);
  432.   }
  433.  
  434.   id4=_open("c:\\auxi2.txt",O_RDWR);
  435.   lseek(id2,0,SEEK_SET);
  436.   while(!eof(id2))
  437.   { bytes1=_read(id2,&movim,sizeof(movim));
  438.             if(bytes1==-1)
  439.             { gotoxy(10,9);printf(" IMPOSIBLE LEER EL ARCHIVO MOVIMIENTOS..!");
  440.       exit(1);
  441.     }
  442.     else
  443.     { if(strcmp(movim.numcuenta,auxc)!=0)
  444.       { bytes2=_write(id4,&movim,sizeof(movim));
  445.         if(bytes2==-1)
  446. { gotoxy(10,11);printf("IMPOSIBLE GRABAR EL ARCHIVO CLIENTES");
  447.         }
  448.               }
  449.             }
  450.   }
  451.   _close(id4);
  452.   _close(id2);
  453.   unlink("c:\\movimientos.txt");
  454.   rename("c:\\auxi2.txt","c:\\movimientos.txt");
  455. }
  456.     }
  457.  
  458.  
  459.  
  460.  
  461.     //*************************************************************************************************
  462.  
  463.       void consignar()
  464.       {
  465.      }
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.     //******************************************************************************************
  474.  
  475.       void retirar()
  476.  
  477.       {
  478.       }
  479.  
  480.  
  481.  
  482.  
  483.  
  484.     //*****************************************************************************************
  485.  
  486.  
  487.     void listar()
  488.  
  489.     { int fila,bytes;
  490.  
  491.       clrscr();
  492.       gotoxy(28,3);printf("**<<LISTADO DE CLIENTES>>**");
  493.       gotoxy(10,5);printf("NUMERO DE LA CUENTA");
  494.       gotoxy(20,5);printf("NUMERO DE LA CEDULA");
  495.       gotoxy(30,5);printf("NOMBRE DEL CLIENTE");
  496.       gotoxy(40,5);printf("TIPO DE CUENTA");
  497.       gotoxy(50,5);printf("DIRECCION DEL CLIENTE");
  498.       gotoxy(60,5);printf("TELEFONO DEL CLIENTE");
  499.       gotoxy(70,5);printf("SALDO DEL CLIENTE");
  500.  
  501.       id1=_open("c:\\clientes.txt",O_RDONLY);
  502.       if(id1==-1)
  503.       {gotoxy(20,10);printf("IMPOSIBLE ABRIR EL ARCHIVO CLIENTES...!");
  504.        getch();
  505.       }
  506.       else
  507.       {lseek(id1,0,SEEK_SET);
  508.        fila=6;
  509.       while(!eof(id1))
  510.      { bytes=_read(id1,&datos,sizeof(datos));
  511.       if (bytes==-1)
  512.       {gotoxy(10,9);printf("IMPOSIBLE LEER EL ARCHIVO CLIENTES...!");
  513.       }
  514.       else
  515.       { gotoxy(10,fila); printf("%s",datos.numcuenta);
  516. gotoxy(20,fila); printf("%s",datos.numced);
  517. gotoxy(30,fila); printf("%s",datos.nomcliente);
  518. gotoxy(40,fila); printf("%s",datos.tcuenta);
  519. gotoxy(50,fila); printf("%s",datos.direcliente);
  520. gotoxy(60,fila); printf("%s",datos.telcliente);
  521. gotoxy(70,fila); printf("%f",datos.saldo);
  522. fila++;
  523. }
  524. }
  525.       }
  526.       _close(id1);
  527.       printf("\n\nPRESIONE<ENTER>PARA CONTINUAR...!");
  528.       getch();
  529.       }
  530.  
  531.      //***************************************************************************************************
  532.  
  533.      void consultar()
  534.  
  535.      { char aux[20],sg='S';
  536. int x;
  537.  
  538. clrscr();
  539. id1=_open("c:\\clientes.txt",O_RDWR);
  540. if(id1==-1)
  541. { gotoxy(20,10);printf("IMPOSIBLE ABRIR EL ARCHIVO CLIENTES...!");
  542. }
  543. else
  544. {while(sg=='S')
  545.  {clrscr();
  546.  gotoxy(10,11);printf(" DIGITE EL NUMERO DE CUENTA A CONSULTAR...!");
  547.  fflush(stdin);gets(aux);
  548.  x=buscar(aux);
  549.  if(x==0)
  550.  {gotoxy(10,11);printf("EL NUMERO DE CUENTA NO EXISTE...!");
  551.  }
  552.  else
  553.  {gotoxy(10,11);printf("NUMERO DE LA CEDULA...%s",datos.numced);
  554.   gotoxy(10,12);printf("NOMBRE DEL CLIENTE...%s",datos.nomcliente);
  555.   gotoxy(10,13);printf("TIPO DE CUENTA...%s",datos.tcuenta);
  556.   gotoxy(10,14);printf("DIRECCION DEL CLIENTE...%s",datos.direcliente);
  557.   gotoxy(10,15);printf("TELEFONO DEL CLIENTE...%s",datos.telcliente);
  558.   gotoxy(10,16);printf("SALDO...%f",datos.saldo);
  559.   }
  560.   gotoxy(10,18);printf("DESEA CONSULTAR MAS DATOS[S/N]...");
  561.   sg=toupper(getch());
  562.   }
  563.  }
  564.  _close(id1);
  565. }
  566.  
  567. //***********************************************************************************************************
  568.  int buscar(char dato[20])
  569.  {int bytes,sw=0,inc=0;
  570.  
  571.  lseek(id1,0,SEEK_SET);
  572.  while (!eof(id1))
  573.  {bytes=_read(id1,&datos,sizeof(datos));
  574.           if(bytes==-1)
  575.  {gotoxy(10,9);printf("IMPOSIBLE LEER EL ARCHIVO CLIENTES...!");
  576.   exit(1);
  577.   }
  578.   else
  579.   { inc++;
  580.   if(strcmp(datos.numcuenta,dato)==0)
  581.   {sw=1;
  582.    break;
  583.    }
  584.   }
  585.  }
  586.  lseek(id1,(long)((inc-1)*(sizeof(datos))),SEEK_SET);
  587.  return sw;
  588.  }
  589.     //**************************************************************************************


« Última modificación: 8 Junio 2010, 15:58 pm por Novlucker » En línea

[D4N93R]
Wiki

Desconectado Desconectado

Mensajes: 1.646


My software never has bugs. Its just features!


Ver Perfil WWW
Re: Ayuda para resolver dos funciones
« Respuesta #1 en: 8 Junio 2010, 15:40 pm »

Podrías usar tags code si quieres.

[code=cpp]tu código aki[/code]


En línea

nicolas_cof


Desconectado Desconectado

Mensajes: 348


Into the Wild


Ver Perfil WWW
Re: Ayuda para resolver dos funciones
« Respuesta #2 en: 8 Junio 2010, 15:45 pm »

Por favor trata de no hacer doble post, utiliza el boton modificar

http://foro.elhacker.net/programacion_cc/este_es_l_sotfware-t296004.0.html;msg1466231#msg1466231

Recomendacion: leer el siguiente tema creado por Littlehorse

http://foro.elhacker.net/programacion_cc/lo_que_no_hay_que_hacer_en_cc_nivel_basico-t277729.0.html

Salu10.
« Última modificación: 8 Junio 2010, 15:49 pm por nicolas_cof » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Ayuda para Resolver 9 consultas
Bases de Datos
Anonymous250 0 3,730 Último mensaje 15 Enero 2012, 18:00 pm
por Anonymous250
Ayuda para resolver practica programacion
Programación General
tote 1992 1 2,138 Último mensaje 26 Enero 2012, 21:36 pm
por Ferno
Que tal un hilo para resolver Ejercicios ??
.NET (C#, VB.NET, ASP)
TrashAmbishion 0 1,651 Último mensaje 3 Abril 2013, 01:17 am
por TrashAmbishion
ayuda para resolver problemas de dev c+++
Programación C/C++
robert666m 1 3,838 Último mensaje 13 Agosto 2014, 20:12 pm
por x64core
ayuda para resolver problema con array
Programación C/C++
MrSkullG4m3r 0 1,495 Último mensaje 1 Noviembre 2017, 00:40 am
por MrSkullG4m3r
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines