<分区>
#include <iostream>
using namespace std ;
int main() {
//Variables
char country;
int taxed ;
float pay ;
char uk_tax = 'a'; //40%
char us_tax ='b';//mulitple by number devide answer by 100
//Inputs
cout << "Enter your total earnings: ";
cin >> pay ;
cout << "Are you within the UK or USA?\n ";
cout << "a) For Uk b) For USA \n ";
cin >> country ;
switch(country)
{
case 1:
//chosen if input is a
if (country == uk_tax )
taxed = 40 * pay / 100;
cout<< "Here are your earnings after Tax £" << taxed ;
break;
case 2:
//chosen if input is b
if (country == us_tax)
taxed = 28 * pay / 100 ;
cout << "Here are your earning after Tax £" << taxed ;
break;
} return 0 }
你好,我只是想知道是否有人可以帮忙看看我在使用这段代码时遇到的问题。该代码不执行 switch 语句。代码本身只是两个国家(美国、英国)的税收计算器,用户通过输入“a”或“b”来选择国家,但我似乎无法获得它在
之后执行 switch 语句