Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<windows.h>
  4. #include <ctype.h>
  5. //* parametros para organizar menues y decoracion de pantalla
  6. void gotoxy(int x, int y) {
  7. COORD coord;
  8. coord.X = x;
  9. coord.Y = y;
  10. SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
  11. }
  12. //* fin de decoracion **//
  13. /* Empieza metodo principal */
  14.  
  15.  
  16. int main( )
  17. {
  18. int xx, yy, menu, folio, nCant;
  19. struct Beneficiario {
  20. char fecha [15];
  21. char edad;
  22. char fam;
  23. char nom[10];
  24. char appat[20];
  25. char apmat[20];
  26. char dir[45];
  27. char sangre[5];
  28. } beneficiarios[10] = {
  29. " "," "," "," "," "," "," "," ",
  30.  
  31.  
  32. };
  33. nCant = 1;
  34.  
  35. do
  36. {
  37. system("cls");
  38. //*****marco se pantalla***********
  39. for (xx=1; xx<=117; xx++)
  40. {
  41. gotoxy(xx,1);
  42. printf ("*");
  43. gotoxy (xx,30);
  44. printf ("*");
  45. }
  46. for(yy=1; yy<=30; yy++)
  47. {
  48. gotoxy (1,yy);
  49. printf("*");
  50. gotoxy (117,yy);
  51. printf ("*");
  52. }
  53. //*****termina marco de pantalla **//
  54.  
  55.  
  56. gotoxy(25,2);
  57. printf("***Despensas a daminficados por sismo***");
  58. //** menu **//
  59. gotoxy(33,4);
  60. printf("1.- Alta de Beneficiario");
  61. gotoxy(33,5);
  62. printf("2.- Busqueda de Beneficiario");
  63. gotoxy(33,6);
  64. printf("3.- Salir");
  65. gotoxy(33,8);
  66. printf("Seleccione una opcion: ");
  67. scanf("%d", &menu);
  68. switch ( menu )
  69. {
  70. case 1:
  71. if ( nCant>10 )
  72. {
  73. gotoxy(33,10);
  74. printf("Insumos agotados\n\n");
  75. system("pause");
  76. }
  77. else
  78. {
  79. gotoxy(33,10);
  80. printf("CAPTURA DE DATOS");
  81. gotoxy(33,11);
  82. printf("===================");
  83. gotoxy(33,13);
  84. printf("Folio: %d", nCant);
  85. gotoxy(33,14);
  86. printf("Fecha (DD-MMM-AAAA): ");
  87. gotoxy(33,15);
  88. printf("Nombre(s): ");
  89. gotoxy(33,16);
  90. printf("Apellido Paterno: ");
  91. gotoxy(33,17);
  92. printf("Apellido Materno: ");
  93. gotoxy(33,18);
  94. printf("Edad: ");
  95. gotoxy(33,19);
  96. printf("Numero de integrantes de la familia: ");
  97. gotoxy(33,20);
  98. printf("Direccion : ");
  99. gotoxy(33,21);
  100. printf("Tipo de sangre: ");
  101. fflush(stdin);
  102. gotoxy(53,14);
  103. gets(beneficiarios[nCant].fecha);
  104. gotoxy(44,15);
  105. gets(beneficiarios[nCant].nom);
  106. gotoxy(51,16);
  107. gets(beneficiarios[nCant].appat);
  108. gotoxy(51,17);
  109. gets(beneficiarios[nCant].apmat);
  110. fflush(stdin);
  111. gotoxy(39,18);
  112. scanf("%s", &beneficiarios[nCant].edad);
  113. while ( isdigit(beneficiarios[nCant].edad) == 0 )
  114. {
  115. gotoxy(33,23);
  116. printf("******* E R R O R *******");
  117. gotoxy(33,24);
  118. printf("¡DEBE INGRESAR UN NUMERO!");
  119. gotoxy(39,18);
  120. printf(" ");
  121. gotoxy(39,18);
  122. scanf("%s", &beneficiarios[nCant].edad);
  123. }
  124. gotoxy(33,23);
  125. printf(" ");
  126. gotoxy(33,24);
  127. printf(" ");
  128.  
  129. fflush(stdin);
  130. gotoxy(70,19);
  131. scanf("%s", &beneficiarios[nCant].fam);
  132. fflush(stdin);
  133. while ( isdigit(beneficiarios[nCant].fam) == 0 )
  134. {
  135. gotoxy(33,23);
  136. printf("******* E R R O R *******");
  137. gotoxy(33,24);
  138. printf("¡DEBE INGRESAR UN NUMERO!");
  139. gotoxy(70,19);
  140. printf(" ");
  141. gotoxy(70,19);
  142. scanf("%s", &beneficiarios[nCant].fam);
  143. }
  144. gotoxy(33,23);
  145. printf(" ");
  146. gotoxy(33,24);
  147. printf(" ");
  148. fflush(stdin);
  149. gotoxy(53,20);
  150. gets(beneficiarios[nCant].dir);
  151. gotoxy(49,21);
  152. gets(beneficiarios[nCant].sangre);
  153. nCant++;
  154. system("pause");
  155. }
  156. break;
  157. case 2:
  158. gotoxy(60,10);
  159. printf(" ");
  160. gotoxy(33,10);
  161. printf("Capture el numero de folio:");
  162. scanf("%d", &folio);
  163. while (folio>10 || folio <= 0 || folio >= nCant )
  164. {
  165. gotoxy(33,10);
  166. printf("Folio invalido o sin datos, favor de checar los datos:");
  167. gotoxy(90,10);
  168. printf("");
  169. gotoxy(91,10);
  170. scanf("%d",&folio);
  171. }
  172. gotoxy(33,12);
  173. printf("DATOS DEL BENEFICIARIO SON:");
  174. gotoxy(33,13);
  175. printf("-------------------------------");
  176. gotoxy(33,14);
  177. printf("Fecha de captura: %s",beneficiarios[folio].fecha);
  178. gotoxy(33,15);
  179. printf("Nombre completo: %s %s %s ",beneficiarios[folio].nom,
  180. beneficiarios[folio].appat, beneficiarios[folio].apmat);
  181. gotoxy(33,16);
  182. printf("Edad: %d anios",beneficiarios[folio].edad);
  183. gotoxy(33,17);
  184. printf("Direccion: %s ",beneficiarios[folio].dir);
  185. gotoxy(33,18);
  186. printf("Tipo de sangre: %s ",beneficiarios[folio].sangre);
  187. gotoxy(33,19);
  188. printf("Personas que integran la familia: %d personas\n\n",beneficiarios[folio].fam);
  189. system("pause");
  190. break;
  191. }
  192. } while ( menu != 3 );
  193.  
  194. return (0);
  195. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement