Code:
#include<stdio.h>
#include<conio.h>
int salesPersonNum[100];
int Quarter1Total=0;
int Quarter2Total=0;
int Quarter3Total=0;
int Quarter4Total=0;
int Quarter=0;
int Sales1[100];
int Sales2[100];
int Sales3[100];
int Sales4[100];
int count;
int num=1;
int i;
int main()
{
while(num!=0)
{
for(count=1; count>=1; count++)
{
printf("\nEnter the Sales Person's ID#: ");
scanf("%d", &salesPersonNum[count]);
printf("Enter the Quarter the sales took place(1-4): ");
scanf("%d", &Quarter);
while(Quarter>4)
{
printf("Enter the Quarter the sales took place(1-4): ");
scanf("%d", &Quarter);
}
while(Quarter<1)
{
printf("Enter the Quarter the sales took place(1-4): ");
scanf("%d", &Quarter);
}
printf("Enter the Sales figure for the selected Quarter %d: ", Quarter);
while(Quarter=1)
{
scanf("%d", &Sales1[count]);
break;
}
while(Quarter=2)
{
scanf("%d", &Sales2[count]);
break;
}
while(Quarter=3)
{
scanf("%d", &Sales3[count]);
break;
}
while(Quarter=4)
{
scanf("%d", &Sales4[count]);
break;
}
for(i=0; i<100; i++)
{
Quarter1Total=Quarter1Total+Sales1[i];
Quarter2Total=Quarter2Total+Sales2[i];
Quarter3Total=Quarter3Total+Sales3[i];
Quarter4Total=Quarter4Total+Sales4[i];
}
break;
}
printf("Enter 0 to Summarize Data, 1 to Continue entering Data: ");
scanf("%d", &num);
}
printf("\nQuarter 1 Total = %d\n", Quarter1Total);
printf("Quarter 2 Total = %d\n", Quarter2Total);
printf("Quarter 3 Total = %d\n", Quarter3Total);
printf("Quarter 4 Total = %d\n", Quarter4Total);
getch();
return 0;
}
what i am trying to do is let the user enter the Sales Person id and then enter the Quarter the sales took place, and then enter the amount of sales in that quarter and then the code will add the numbers for each of the quarters entered. ie it will add all of quarter 1's sales figure and then quarter 2's sales figure and so on.
and then asks the user whether to continue entering data or summarize (display the Quater 1 results Quarter 2 results and so on.
but it wouldn't work
please help.