Good evening, I am new to C++ and I'm having a bit of trouble with a simple menu
I'm trying to generate a menu with two options; one is used to calculate the amount of sales, and the other one is to simple shut down the application
#include <iostream>
#include <string>
#include <cmath>
usingnamespace std;
int main ()
{
int loop = 1;
int choice;
double sales;
while (loop ==1)
{
cout << "::MENU::\n\n"
<< "1. Calculate \n"
<< "2. Exit \n";
cin >> choice;
switch (choice)
{
case 1:
system ("CLS");
cout << "To calculate, please type in the the number of sales \n\n";
cout << "Keep in mind that \n";
cout << "Sales 1 - 100,000 will be multiplied by 2% \n";
cout << "Sales 100,001 - 400, 000 by 5% \n";
cout << "Sales 400,000 and over by 10% \n\n";
cin >> sales;
if (sales <= 100,000)
{
(sales*.02);
cout << "The amount of sales is " << sales << endl;
system ("pause");
}
elseif (sales >= 100,001 && sales <= 400,000)
{
(sales*.05);
cout << "The amount of sales is " << sales << endl;
system ("pause");
}
elseif (sales > 400,000)
{
(sales*.1);
cout << "The amount of sales is " << sales << endl;
system ("pause");
}
case 2:
if (choice ==2)
{
exit (0);
}
}
}
}
The compiler does not show any errors, but while I am running the application, it doesn't display the amount of sales whenever I type in the digits, it just goes back directly to the selection menu. Can anyone tell me what I am doing wrong? Any help will be appreciated