Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- struct carnaval
- {
- char nome [10];
- char cor [10];
- int quantidade;
- };
- int main ()
- {
- int x=1;
- struct carnaval blocos[2];
- void listar();
- void incluir();
- void buscar();
- while (x!=0)
- {
- printf ("1) Incluirn");
- printf ("2) Listarn");
- printf ("3) Buscarn");
- printf ("0) Sairn");
- scanf ("%d", &x);
- if (x==0)
- {
- break;
- }
- switch (x)
- {
- case 1:
- incluir (blocos);
- break;
- case 2:
- listar (blocos);
- break;
- case 3:
- buscar ();
- break;
- case 0:
- break;
- default:
- printf ("valor inválidon");
- break;
- }
- }
- }
- void incluir (struct carnaval *incluido[])
- {
- int i;
- for (i=0; i<2; i++)
- {
- getchar();
- fgets ((*incluido)[i].nome, 10, stdin);
- fgets ((*incluido)[i].cor, 10, stdin);
- scanf ("%d", &(*incluido)[i].quantidade);
- }
- }
- void listar (struct carnaval print[])
- {
- int y;
- for (y=0; y<2; y++)
- {
- printf ("n%s", print[y].nome);
- printf ("%s", print[y].cor);
- printf ("%dnn", print[y].quantidade);
- }
- }
- void buscar ()
- {
- printf ("testen");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement