I am trying to write a program that will receive as input an item type and then depending on the input, calculate tax for it, etc. If the user does not enter a valid item type, it is supposed to ask the user to re-enter the correct item type. I am having problems with the condition section of the while loop. Can anyone suggest a hint to help me correct the problem? Thanks.
Code:#include <iostream> #include <string> #include <cstdlib> using namespace std; int main() { double price ; double discount ; double tax ; double total ; double discount_amount ; double tax_amount ; char item_type [8] ; cout << "Enter the Item Type: food, clothes, toys, or other: " ; cin >> item_type ; while (item_type == "food" || item_type == "clothes" || item_type == "toys" || item_type == "other") { cout << "Enter Item Price : $" ; cin >> price ; cout << "Enter Discount Percentage (%): " ; cin >> discount ; // Checks if item is taxable and calculates tax. if (item_type == "toys" || item_type == "other") { cout << "Enter Tax Percentage (%): " ; cin >> tax ; } cout << endl ; cout << "The Item Price is: $" << price << "." <<endl ; discount_amount = price - (price * (discount/100)); cout << "The Discount Amount is: $" << discount_amount << endl ; tax_amount = (price - (price * (discount/100))) * (tax/100); cout << "The Tax Amount is : $" << tax_amount << endl ; cout << "The Final Bill Amount is : $" << discount_amount + tax_amount ; cout << endl ; } cout << "Please Enter a Valid Item Type: " <<endl ; cin >> item_type ; system("PAUSE") ; return 0; }