|
From: Per W. <pw...@ia...> - 2008-02-26 11:50:58
|
After it has produced this error?
Wouldn't it be a good idea to actually tell what error it has produced?
And are you talking about a compilation error or a runtime error?
Or do you expect every reader on this list to cut and paste your source
code just to test and compile and optionally run it?
/pwm
On Tue, 26 Feb 2008, Igor Nunes da Cruz wrote:
> Create a program that stores for each of 10
> Products the following data: name, code, value and
> An array of demands from sales, Monday to Friday,
> In the first two weeks of the month of July only.
> The program will show, for each product, the day
> Of the week on which it had higher mean
> Sale and the value of this medium.
> How to proceed after it has produced this error?
> #include<stdio.h>
> #include<conio.h>
> #define size 2
> main()
> {
> struct reg{
> char nome_p[20];
> int cod,baixa[2][5];
> float preco;
> }venda[size];
> int l,c;
> float media_v=0;
> for(l=0;l<size;l++){
> fflush(stdin);
> printf("\nNome do produto %d: ",l+1);
> gets(venda[l].nome_p);
> printf("\nCodigo do produto %s:
> ",venda[l].nome_p);
> scanf("%d",&venda[l].cod);
> while(venda[l].cod==venda[c].cod){
> c=0;
> printf("Erro! Codigo existente! Digite outro
> codigo: ");
> scanf("%d",&venda[l].cod);
> }
> printf("Valor do produto %s: R$
> ",venda[l].nome_p);
> scanf("%f",&venda[l].preco);
> for(l=0;l<2;l++)
> {
> for(c=1;c<6;c++)
> {
> printf("[ - Mes de
> Julho - ]");
> printf("
> ------------------ ");
> printf(" Semana %d
> ",l+1);
>
> scanf("%d",&venda[l].baixa[l][c]);
> printf(" %d Semana
> %d",c+1,venda[l].baixa[l][c]);
>
> scanf("%d",&venda[l].baixa[l][c]);
>
> printf("\nQuantidade de %s vendido na %d: ",venda[l].nome_p,c+1);
>
> scanf("%d",&venda[l].baixa[l][c]);
> media_v =
> media_v+venda[l].baixa[l][c]/size l;
> }
> printf("\n\n");
> }
> }
> printf("O produto vendido foi %s na semana %d - %d e sua media de
> venda foi
> %.2f",venda[l].nome_p,venda[l].baixa[l][c].sem,venda[l].baixa[l][c].dia,media_v);
> getch();
> }
> Thanks,
>
> --
> Igor da Cruz
>
|