Console.Write无法正常工作 [英] Console.Write not working

查看:113
本文介绍了Console.Write无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了适用于Mac的Visual Studio 2019。我有以下C#代码:

I downloaded Visual Studio 2019 for Mac. I have the following C# code:

使用  系统;



namespace  变量

{

     class  计划

     {

         static   void   Main( < span style ="color:#009695"> string
[]  args)

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; {

             字符串   myFirstName;

   ;           Console.WriteLine( "   是什么名称? " );

             Console.Write( " 在 您的第一个名称中输入   " );

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; myFirstName&NBSP; =&NBSP ; Console.ReadLine();



              string   myLastName;

             Console.Write( " 类型 是您的姓氏:  " );

  ;            myLastName  =  Console.ReadLine();



             Console.WriteLine( " 您好,  "   +  myFirstName  +  "   "   +  ; myLastName);

             ; Console.ReadLine();      

         }

    }

}

using System;

namespace Variables
{
    class Program
    {
        static void Main(string[] args)
        {
            string myFirstName;
            Console.WriteLine("What is your name?");
            Console.Write("Type in your first name: ");
            myFirstName = Console.ReadLine();

            string myLastName;
            Console.Write("Type is your last name: ");
            myLastName = Console.ReadLine();

            Console.WriteLine("Hello, " + myFirstName + " " + myLastName);
            Console.ReadLine();      
        }
    }
}




但是,当我在Visual Studio应用程序输出上运行它时,我只会得到"你叫什么名字?"。就是这样。它没有显示其余部分,我看不到"键入你的拳头名称:"。

However, when I run it on the Visual Studio Application Output, I only get "What is your name?". And that's it. It doesn't show the rest, I cannot see "Type in your fist name: ".

此外,当我尝试在外部控制台上执行它时,终端没有完全执行代码!

Also, when I try executing it on an external console, the terminal doesn't execute the code at all!

有谁知道如何让它工作?

Does anyone know how I can get this to work?

推荐答案

<你好Bryan.BL,

Hi Bryan.B.L,

欢迎来到MSDN论坛。

Welcome to MSDN forum.

根据你的描述,似乎你应该将项目选项设置为能够在外部控制台中运行。

According to your description, it seems that the you should set the project option to be able to run in the external console.

请打开项目选项>>选择运行>>配置>>默认,然后选中 在外部控制台上运行。

Please open the project options>> select Run>>Configuration>>Default, then check Run on external console.

预计会有任何反馈。

最好的问候,

Dylan


这篇关于Console.Write无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆