Question: How to fix this c++ loop! My code: #include #include #include #include using namespace std; int main() { const int SIZE = 128; char choice;

How to fix this c++ loop!

How to fix this c++ loop! My code: #include #include #include #include

My code:

#include #include #include #include using namespace std;

int main() {

const int SIZE = 128; char choice; char confirm; char productName[SIZE]; double price; double total; int count = 0;

while(choice != 'N') { while(confirm != 'Y') { cout > price; if(cin.fail()) { cin.clear(); cin.ignore(SIZE, ' '); cout > price; } cout > confirm; if(cin.fail()) { cin.clear(); cin.ignore(SIZE, ' '); cout > confirm; } confirm = toupper(confirm); cin.ignore(SIZE, ' '); } total += price; count++; cout > choice; if(cin.fail()) { cin.clear(); cin.ignore(SIZE, ' '); cout > choice; } choice = toupper(choice); cin.ignore(SIZE, ' '); } cout

return 0; }

ter the product' Please en name: ahmecd Please eneter the product's price: 15 Product: ahmed Press y to confirm and n to enter again: y Press y to continue and n to checkout: y Press y to continue and n to checkout: y Press y to continue and n to checkout: y Press y to continue and n to checkout:n You have entered 4 products. The total cost of your purchase is: $60.00 price: $15.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!