我有一个问题在我的代码中循环if语句.我查看了stackoverflow上的其他线程,但我无法让它多次工作.我正在尝试创建的程序是铸造公司的基本转换器.我尝试做的是使用户可以输入所需的转换类型,然后输入蜡的重量.然后它将为使用者提供正确数量的贵金属克.问题是我需要它从一开始就运行直到用户完成使用它.我尝试使用while语句,但它只是循环if语句的else部分.这是我的代码供参考:
static void Main(string[] args)
{
double waxWeight, bronzeWeight, silverWeight, fourteenkGoldWeight,
eighteenkGoldWeight, twentytwokGoldWeight, platinumWeight;
string wW;
bool doesUserWantToLeave = false;
Console.WriteLine("Please specify the type of conversion you would like to accomplish:"
+ "\n(Bronze, Silver, 14k Gold, 18k Gold, 22k Gold, Platinum, or Exit):");
string conversionType = Console.ReadLine();
//bool B = conversionType == "Bronze";
//bool S = conversionType == "Silver";
//bool ftG = conversionType == "14k Gold";
//bool etG = conversionType == "18k Gold";
//bool ttG = conversionType == "22k Gold"; …Run Code Online (Sandbox Code Playgroud)