Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 21st, 2012  |  syntax: C  |  size: 0.80 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. typedef struct{
  2.     char nome[20];
  3.     int cod_vendedor;
  4.     int semana[4];
  5.     int total_vendas;
  6. }Vendedor;
  7.  
  8. void LeVendedor (Vendedor *a)
  9. {
  10.     int i,cont = 0;
  11.     printf("Digite o nome do vendedor: ");
  12.     fflush(stdin);
  13.     gets(a->nome);
  14.     printf("Digite o código do vendedor: ");
  15.     fflush(stdin);
  16.     scanf("%d", &a->cod_vendedor);
  17.     printf("Digite o numero de vendas das respectivas semanas\n");
  18.     for(i=0;i<4;i++){
  19.         a->cont++;
  20.         printf("Digite a venda da semana %d", a->cont);
  21.         scanf("%d",&a->semana[i]);
  22.     }
  23.     for(i=0;i<4;i++){
  24.         a->total_vendas += a->semana[i];
  25.     }
  26. }
  27. void EscreveVendedor (Vendedor a)
  28. {
  29.     printf("\nO vendedor (%s) de codigo (%d) efetuou o maior numero de vendas no valor de (%d)",a.nome, a.cod_vendedor, a.total_vendas);
  30. }