okay, i'm trying to make a for loop that will run from 1 to the number of records i've entered in a previous while loop
then i'm making calculations based on the number of things they buy (more you buy, less unit cost) here's my code, my output is very confusing as it just lists a slew of numbers after each other, i don't know what the problem is, or where it is. help would be appreciated. here's what i got.
the part incased in asterixes is where i'm running into problems, i don't know if you need the rest of the program for reference
#include <stdio.h>
int main()
{int id_num[20];
int num_chair[20];
int num_sofa[20];
int total_chair[20];
int total_sofa[20];
int total_both[20];
int c,i,s;
printf("Quantity\t Chair Price\t Sofa Price\n");
printf("1-50\t\t $80\t\t $325\n");
printf("51-100\t\t $65\t\t $260\n");
printf("101-200\t\t $55\t\t $225\n");
printf("over 200\t $50\t\t $190\n");
{
int x=1;
printf("Enter <0> under ID number when finished\n");
scanf("%d", &id_num[x]);
while(id_num[x] != 0) {
printf("Enter the amount of chairs you desire to order\n");
scanf ("%d", &num_chair[x]);
printf("Enter the amount of sofas you desire to order\n");
scanf ("%d", &num_sofa[x]);
x++;
printf ("Enter <0> under ID number when finished\n");
scanf("%d", &id_num[x]);
}
**************************************************
for (c=1;c<x;c++){
if (num_chair[c]<=50)
total_chair[c]=num_chair[c]*80;
else if (num_chair[c]<=100)
total_chair[c]=num_chair[c]*65;
else if (num_chair[c]<=200)
total_chair[c]=num_chair[c]*55;
else if (num_chair[c]>200)
total_chair[c]=num_chair[c]*50;
}
for (s=1;s<x;s++){
if (num_sofa[s]<=50)
total_sofa[s]=num_sofa[s]*80;
else if (num_sofa[s]<=100)
total_sofa[s]=num_sofa[s]*65;
else if (num_sofa[s]<=200)
total_sofa[s]=num_sofa[s]*55;
else if (num_sofa[s]>200)
total_sofa[s]=num_sofa[s]*50;
}
for (i=1;i<x;i++)
{
printf ("%d",&id_num[i],"\n");
printf ("%d",&num_chair[i],"\n");
printf ("%d",&total_chair[i],"\n");
"\n";
}
**********************************************
}
}