0

Don’t get to enter price can someone help

#include <iostream> #include <string.h> using namespace std; int main() { int price, username,password; float tax,totalPrice; char response='Y'; cout <<"Enter Username: "; cin >> username; fflush(stdin); cout <<"Enter Password: "; cin >>password; fflush(stdin); if(username==1234&& password==6789) { do { cout <<"\nEnter price of your car: "; cin >> price; tax = 0.5*price/100; totalPrice=price+tax; cout <<"The total price of your car including tax is %2f\n"totalPrice; cout << "\nDo you want to check again(Y/N)? "; fflush(stdin); cin >> response; } while(response!='Y'); { cout <<"Enter price of your car: "; cin >> price; tax=25*price/100; totalPrice=price+tax; cout <<"Do you want to check again"; fflush(stdin); cin >> response; } } else { cout <<"Wrong Credentials"; } return 0; }

29th Mar 2021, 7:59 AM
David
David - avatar
2 Answers
+ 1
okay thanks
29th Mar 2021, 8:47 AM
David
David - avatar
0
the while was for calculating another tax of 25%
29th Mar 2021, 8:42 AM
David
David - avatar