小编Chr*_*s R的帖子

C#,获取用户价值并重置它

现在我的问题是获得选择2来保存和重写选择中所写的内容1.选择3应该重置所有内容.现在我尝试使用if if if if仍然没有让它工作.

while (true)
{
    Console.WriteLine("\tWelcome to my program"); // Makes the user select a choice
    Console.WriteLine("[1] To write");
    Console.WriteLine("[2] To see what you wrote");
    Console.WriteLine("[3] Reset");
    Console.WriteLine("[4] End");

    string choice = Console.ReadLine();
    string  typed = ("");

    if (choice == "1") // If 1 program asks for text
    {
        Console.WriteLine("Thank you for your choice, input text"); 
        typed = Console.ReadLine(); 
    }
    else if (choice == "2") // Is supposed to say "You wrote, and what user wrote"
    {
        Console.WriteLine(typed); …
Run Code Online (Sandbox Code Playgroud)

c# if-statement

3
推荐指数
1
解决办法
77
查看次数

标签 统计

c# ×1

if-statement ×1