Can anyone help me to check what is wrong with my POS?

October 11, 2016 at 00:50:20
Specs: Windows 7
#include<stdio.h>
#include<conio.h>
main()
{
int i, e[9999], choose, size,itemq;
float price[9999],qty[9999], total[9999],tender,change,sumtotal;
char employee[9999];

for(i=1; i<=1000; i++){
e[i] = 0;
price[i]=0;
qty[i]=0;
}

printf("What do you want to do?\n");
printf("[1] Add Items\n");
printf("[2] Remove Items\n");
printf("[3] Sell to Customer\n");
printf("[4] Purchase Form\n");
printf("[5] View Inventory\n");
printf("[6] Exit Program\n");

do{
printf("Choose: \n");
scanf("%d", &choose);

if(choose==1){
printf("Number of Items to be Added: \n");
scanf("%d", &size);


for(i=1;i<size;i++){
printf("Item Number: ");
scanf("%d", &i);


if(e[i] != 0)
printf("Item is already added");


else {
printf("Item number %d Name: \n", i);
scanf("%s", &employee[i]);
printf("Item Number %d Price: \n", i);
scanf("%d", &price[i]);
printf("Item Number %d Quantity: \n", i);
scanf("%d", &qty[i]);
printf("The item has been added to your inventory.\n");
e[i] = i;
}}}


else if(choose==2){
printf("Remove Item Number: \n");
scanf("%d", &i);

if(e[i]==0){
printf("Item Number entered does not exist.");}


else {
printf("The item %s has been removed.\n", employee[i]);
e[i] = 0;
price[i]=0;
qty[i]=0;
}}


else if(choose == 3){


for(i=1;i<size;i++){
printf("\Enter the number of items: \n");
scanf("%d", &size);
printf("Enter the Item number: \n");
scanf("%d", &i);


if(e[i] == 0){
printf("Item Number entered does not exist.");}


else{
printf("%s-----%d", employee[i], price[i]);
printf("Quantity: \n");
scanf("%d", &itemq);
total[i]=qty[i]*price[i];
printf("Total: %.2f\n", total);
}}
sumtotal=total[i]+total[i++];
printf("Total Amount: %f.2\n", sumtotal);
printf("Amount Tendered: \n");
scanf("%.2f", &tender);
change=tender-sumtotal;
printf("Change: %d\n");
}


else if(choose == 4){
printf("Item No. \tItem Name \tPrice \tQuantity \tAmount\t");
printf("%d \t%s \t%.2f \t%d \t %.2f\n", i, employee[i], price[i], qty[i], total[i]);
i++;
printf("Total Amount: %.2f", sumtotal);
}


else if(choose == 5){
printf("\t\tItem Invetntory\n");

if(e[i]!=0)
{
printf("Item No.\t Item Name\t Quantity\t Price\n");
for(i=1; i<=size; i++){
qty[i]-=itemq;
scanf("%d\t %s\t %d\t %.2f\n", i, employee[i], qty[i], price[i]);
i++;
}}}


else if(choose == 6){
printf(" ");
}


else{
printf("invalid choice!!\n\n");
}
}


while(choose != 6);
getch();
}


See More: Can anyone help me to check what is wrong with my POS?

Reply ↓  Report •


#1
October 11, 2016 at 01:19:23
1. What is the program supposed to do?
2. What output do you expect?
3. What output do you get?
4. What makes you think that anything is wrong?

As it looks like a homework question, the only comment I will make is that you should read up on the "switch" statement. Also, you might consider using a debugger to single-step through the program.


Reply ↓  Report •
Related Solutions


Ask Question