I want to exit the loop if the user presses "q" but when I press q, it goes into an infinite loop. What is wrong with my if statement? Why does it not recognize when the user presses "q"?
#include<iostream>
using namespace std;
int main()
{
string user_input;
double price;
do
{
cin >> price;
int multiple = price * 100;
if (user_input == "q")
{
break;
}
else if (multiple % 5 == 0)
{
cout << "This is a multiple of 0.05" << endl;
return 1;
}
else
{
cout << "No multiple" << endl;
}
} while (1 || user_input != "q");
system("pause");
}