Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <windows.h>
  3. #include <stdlib.h>
  4. #define TAM 25
  5. int main(){
  6. char nombre[20],car,nomb,cuen;
  7. FILE *f, *r, *c;
  8. int contPos, mostrar, cuenta,cont;
  9. int i, j;
  10. int bingo[TAM];
  11. char num1, num2;
  12.  
  13.  
  14.  
  15.  
  16. system("COLOR A");
  17. printf("************************BINGO******************\n");
  18.  
  19.  
  20. //USUARIO
  21. printf("\n");
  22. printf("Escribe tu nombre: ");
  23. scanf("%s", nombre);
  24.  
  25.  
  26. //Inicializar el array a 0
  27. for (i=1;i<=TAM;i++){
  28. bingo[TAM]=0;
  29. }
  30.  
  31. fflush(stdin);
  32. //Bucle buscar
  33. contPos=1;
  34. do{
  35. f=fopen(nombre, "r+");
  36. }while((f=fopen(nombre, "r+"))==NULL);
  37. printf("\n");
  38. printf("Aqui estan los numeros de tu carton: \n");
  39. //Guardarlo en el array
  40. while(!feof(f)){
  41. fscanf(f, "%d" , &mostrar);
  42. bingo[cont]=mostrar;
  43. contPos++;
  44.  
  45. }
  46. fclose(f);
  47. cont=0;
  48. //Mostrar array
  49. for (i=0;i<TAM;i++){
  50. cont++;
  51. printf("%3d",bingo[i]);
  52. if (cont==5){
  53. printf("\n");
  54. cont=0;
  55. }
  56. if (bingo[i]==0){
  57. printf(" ");
  58. }
  59. }
  60. printf("\n\n\n");
  61.  
  62.  
  63. //cerrar el fichero
  64.  
  65.  
  66.  
  67.  
  68.  
  69. printf("\n\n");
  70. fflush(stdin);
  71. getchar();
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement