Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct
- {
- int codigo, Mouro, Mprata,Mbronze;
- char nome[20];
- } pais;
- void CADASTRO (int n, pais CAD[])
- {
- int i;
- for (i=0; i<n; i++)
- {printf ("Codigo:");
- scanf ("%d", &CAD[i].codigo);
- printf ("Nome:");
- fflush (stdin);
- gets (CAD[i].nome);
- printf ("Med. de Ouro, Prata, Bronze");
- scanf ("%d %d %d", &CAD[i].Mouro, &CAD[i].Mprata, &CAD[i].Mbronze);}
- }
- main ()
- {
- FILE *F;
- int n;
- pais *V;
- do
- {
- printf ("Digite o nº de paises");
- scanf ("%d", &n);
- }
- while (n<2 || n>100);
- int op;
- printf (" 1 - Cadastrar \n 2 - Consultar \n 3 - Listar Medalhas de outro \n 4 - Salvar em arquivo \n 5 - Carregar informação em Arquivo \n 6 - Sair");
- scanf ("%d", &op);
- V = (pais*) malloc (n*sizeof(pais));
- switch (op)
- {
- case 1:
- CADASTRO (n, V); break;
- case 2:
- break;
- case 3:
- break;
- case 4:
- break;
- case 5:
- break;
- case 6:
- return 0;
- break;
- }
- fclose (F);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement