gpt4 book ai didi

c# - C#程序无法正常工作,控制台输出为空白

转载 作者:行者123 更新时间:2023-12-02 10:54:21 25 4
gpt4 key购买 nike

这是控制台空白的程序-

using System;
namespace here
{
class Program
{
static void Main(string[] args)
{
double width, height, woodLength, glassArea;
string widthString, heightString;
widthString = Console.ReadLine();
width = double.Parse(widthString);
heightString = Console.ReadLine();
height = double.Parse(heightString);
woodLength = 2 * ( width + height ) * 3.25 ;
glassArea = 2 * ( width * height ) ;
Console.WriteLine ( "The length of the wood is " + woodLength + " feet" ) ;
Console.WriteLine( "The area of the glass is " + glassArea + " square metres" ) ;
Console.ReadKey(true);
}
}
}

这是显示输出的程序-
using System;

namespace here
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Console.ReadKey(true);
}
}
}

正如我在其他文章中所读到的,我什至尝试卸载所有防病毒软件。没有什么变化。

最佳答案

您的程序正在正确执行。
控制台为空白,因为您在提示开始时未打印任何内容。
尝试这个

    using System;
namespace here {
class Program
{
static void Main(string[] args)
{
double width, height, woodLength, glassArea;
string widthString, heightString;
Console.WriteLine ("Enter width");
widthString = Console.ReadLine();
width = double.Parse(widthString);
Console.WriteLine ("Enter height");

heightString = Console.ReadLine();
height = double.Parse(heightString);
woodLength = 2 * ( width + height ) * 3.25 ;
glassArea = 2 * ( width * height ) ;
Console.WriteLine ( "The length of the wood is " +
woodLength + " feet" ) ;
Console.WriteLine( "The area of the glass is " +
glassArea + " square metres" ) ;
Console.ReadKey(true);
}
}
}

看一下这里的输出:
Output to the code snippet above in the answer post

关于c# - C#程序无法正常工作,控制台输出为空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36110861/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com