Ya, I keep getting this error when I try to compile my code can anyone help?
line 41: syntax error before or at: )
See bolded line origin = 1
Code:#include <stdio.h> int Calculate_duty(int, int, int, int); void Print_duty(int, int, int, int, int); int main(void) { char yes_or_no; int origin, category, quantity, price; printf("Do you have more customer form process (type: Y for yes, N for no)?\n"); scanf("%c", &yes_or_no); while ((yes_or_no != 'Y') && (yes_or_no != 'N')) { printf("You have to enter Y for Yes or N for No. Please try again. \n"); /* Discard the end of line character or other characters */ scanf("%c",&yes_or_no); } while (yes_or_no = 'Y') { printf("What is the origin of the goods (type: 1 for US, 2 for China, 3 for Brazil)?\n"); scanf("%d", &origin); printf("What category of goods (type: 1 for food, 2 for clothing, 3 for wood)?\n"); scanf("%d", &category); printf("What is the quantity?\n"); scanf("%d", &quantity); printf("What is the unit price?\n"); scanf("%d", &price); Print_duty(origin, category, quantity, price, Calculate_duty(price, quantity, category, origin)) } } int Calculate_duty(int price, int quantity, int category, int origin) { int percent, duty; for (origin = 1) { for (category = 1) percent = 0 for (category = 2) percent = 0 for (category = 3) percent = 0.05 } for (origin = 2) { for (category = 1) percent = 0.02 for (category = 2) percent = 0.03 for (category = 3) percent = 0.04 } for (origin = 3) { for (category = 1) percent = 0.01 for (category = 2) percent = 0.02 for (category = 3) percent = 0.08 } return duty = price*quantity*percent; } } void Print_duty(int origin, int category, int quantity, int price, int duty) { int percent, shipment; for (origin = 1) { for (category = 1) percent = 0 for (category = 2) percent = 0 for (category = 3) percent = 0.05 } for (origin = 2) { for (category = 1) percent = 0.02 for (category = 2) percent = 0.03 for (category = 3) percent = 0.04 } for (origin = 3) { for (category = 1) percent = 0.01 for (category = 2) percent = 0.02 for (category = 3) percent = 0.08 } shipment = quantity*price; printf("Origin Category Quantity Unit Price Shipment Tax Rate Duty\n"); printf("%d \t %d \t %d \t %.2d \t %.2d \t %.2d \t %.2d", &origin, &category, &quantity, &percent, &duty); printf("The amount due is %.2d \n", &duty); printf("**********************************************************"); }



LinkBack URL
About LinkBacks


