Advertisement
FAMDS

Mercado

Nov 13th, 2022 (edited)
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. int
  4. main (void)
  5. {
  6.  
  7.   struct supermercado           //Definindo informacoes de Cadastro
  8.   {
  9.     char item[10];
  10.     char marca[20];
  11.     float valor;
  12.   };
  13.  
  14.   struct supermercado supermercado;     // Definindo a variavel
  15.  
  16.   printf ("\n::::.... Cadastro produtos ....::::\n\n\n");
  17. //registrando informações
  18.   printf ("Informe o item:");
  19.   fflush (stdin);
  20.   fgets (supermercado.item, 10, stdin);
  21.  
  22.   printf ("Informe a marca:");
  23.   fflush (stdin);
  24.   fgets (supermercado.marca, 20, stdin);
  25.  
  26.   printf ("Informe o valor:");
  27.   scanf ("%f", &supermercado.valor);
  28. //imprimindo informações registradas
  29.   printf ("\n\n --------- informações registradas ---------\n\n");
  30.   printf ("Item ..................: %s\n", supermercado.item);
  31.   printf ("Marca .................: %s\n", supermercado.marca);
  32.   printf ("Valor .................: R$%.2f\n", supermercado.valor);
  33.  
  34.   getch ();
  35.   return (0);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement