回 帖 发 新 帖 刷新版面

主题:如何让.net控制台应用程序暂停

各位高手,请教:我的程序启动时,总是一闪就结束了,我都看不清楚结果,为什么呢?
下面是源码:
#include "stdafx.h"

#using <mscorlib.dll>

using namespace System;
__value enum WeekDay
{
    Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
};

int _tmain()
{
    WeekDay w=Monday;
    Console::Write("value of w is ");
    Console::WriteLine (w);
    switch(w)
    {
    case Monday:
        Console::WriteLine("it's a monday!");
        break;
        case Tuesday:
        Console::WriteLine("it's a tuesday!");
        break;
        case Wednesday:
        Console::WriteLine("it's a wednesday!");
        break;
        case Thursday:
        Console::WriteLine("it's a thursday!");
        break;
        default:
        Console::WriteLine("it's a monday!");
        break;
    }




    // TODO: 请用您自己的代码替换下面的示例代码。
    /*Console::WriteLine(S"Hello World");
    return 0;*/
}

回复列表 (共2个回复)

沙发

在最后加上 Console.ReadLine();

板凳

按Ctrl+F5

我来回复

您尚未登录,请登录后再回复。点此登录或注册