Soooo这个程序似乎是合乎逻辑的,我已经能够在C++和java中使用相同的想法创建程序,每当我运行它时,所有东西都会突然关闭......也许我只是得到了一些下载错误的东西控制台窗口刚刚关闭? c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
/*
int[] numbahs= new int[5];
numbahs[0] = 4;
numbahs[1] = 3;
Console.WriteLine(numbahs[1].ToString());
string[] cow = new string[] { "pee", "poop" };
foreach (string pee in cow)
{
Console.WriteLine(pee);
}
*/
int x;
int y;
Console.WriteLine("enter x:");
x = Console.Read();
Console.WriteLine("enter y:");
y = Console.Read();
int z = (x > y)? 8 : 2;
Console.WriteLine("x:{0} y:{1} z:{2}",x ,y, z);
if (z > x)
{
Console.WriteLine("yoyo");
Console.Read();
}
else { Console.WriteLine("hihi"); }
Console.Read();
}
}
}
的WriteLine( “YOYO” .. “日冰” ......啊......昔日的美好时光:d – 2014-10-18 20:33:50
什么你是否在阻止程序终止?一旦它到达程序结束,它肯定会终止。为什么你期望它不这样做? – 2014-10-18 20:34:00
@DavidHeffernan推测是'Console.Read'。 – 2014-10-18 20:36:07