Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- #include <stdlib.h>
- #define TAM 25
- int main(){
- char nombre[20],car,nomb,cuen;
- FILE *f, *r, *c;
- int contPos, mostrar, cuenta,cont;
- int i, j;
- int bingo[TAM];
- char num1, num2;
- system("COLOR A");
- printf("************************BINGO******************\n");
- //USUARIO
- printf("\n");
- printf("Escribe tu nombre: ");
- scanf("%s", nombre);
- //Inicializar el array a 0
- for (i=1;i<=TAM;i++){
- bingo[TAM]=0;
- }
- fflush(stdin);
- //Bucle buscar
- contPos=1;
- do{
- f=fopen(nombre, "r+");
- }while((f=fopen(nombre, "r+"))==NULL);
- printf("\n");
- printf("Aqui estan los numeros de tu carton: \n");
- //Guardarlo en el array
- while(!feof(f)){
- fscanf(f, "%d" , &mostrar);
- bingo[cont]=mostrar;
- contPos++;
- }
- fclose(f);
- cont=0;
- //Mostrar array
- for (i=0;i<TAM;i++){
- cont++;
- printf("%3d",bingo[i]);
- if (cont==5){
- printf("\n");
- cont=0;
- }
- if (bingo[i]==0){
- printf(" ");
- }
- }
- printf("\n\n\n");
- //cerrar el fichero
- printf("\n\n");
- fflush(stdin);
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement