#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int n;
char ans, cont;
ans = 'y';
while (true){
if (ans == 'y' || ans == 'Y'){
cout << "Enter a price:" << endl;
cin >> n;
n++;
cout << "do you want to continue? y/n" <<endl;
cin >> ans;
switch (n) {
//Vat Prices
case 1:
if (n<300)
cout << "You have to pay" << endl << n * 1.1 << " $" << endl <<endl;
break;
case 2:
if (n==300)
cout << "You have to pay" << endl << (n * 1.05) * 1.1 << " $" << endl <<endl;
break;
case 3:
if (n>=301 && n <= 500)
cout << "You have to pay" << endl << (n * 1.1) * 1.1 << " $" << endl <<endl;
break;
case 4:
if (n>= 501 && n <= 1000)
cout << "You have to pay" << endl << (n * 1.2)*1.1 << " $" << endl <<endl;
case 5:
if (n>1000)
cout << "You have to pay" << endl << (n * 1.3)* 1.1 << " $" << endl <<endl;
break;
}
}
}
return 0;
}
如果我把n
程序不会通过开关,一个小时前它工作正常,我不知道发生了什么