int checkItem(unsigned char msg[],int quantity){ item result = scan(getUPC(msg)); // Does Not Exist if (result.upc[0] == '\0'){ printMsg("Item does not exist!",0,22); printf("Item does not exist!\n"); return 0; } else{ // Exist printMsg("Item exists!",0,22); printf("Item exists!\n"); if (quantity > 0){ //printf("item's stock:%d\n",result.stock); if (result.stock >= quantity){ printMsg("There are enough items in the stock!",0,24); printf("There are enough items in the stock!\n"); return 1; } else{ printMsg("There are not enough items in the stock!",0,24); printf("There are not enough items in the stock!\n"); return 0; } } else return 1; } }
void Product::print() const { cout << "UPC: " << getUPC() << endl; cout << "Name: " << getName() << endl; cout << "Price: " << getPrice() << endl; }