注册 登录
编程论坛 C++教室

C++程序异常求解

xiaoxiliushu 发布于 2013-12-28 22:54, 349 次点击
//201.cpp

#include "stdafx.h"

using namespace System;
// Define the enumeration at global scope
enum class Month{January, February, March, April,
 May, June, July, August,
 September,October, November, December};

int main(array<System::String ^> ^args)
{
 Month month = Month::January;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::February;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::March;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::April;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::May;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::June;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::July;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::August;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::September;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::October;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::November;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 month = Month::December;
 Console::WriteLine(L"Monthis {0} and the value is {1} ", month, safe_cast<int>(month));
 return 0;
}
这个程序运行闪一下就退出了,我在后面加上system("PAUSE"),也不行,不识别system,不知道怎么办?
3 回复
#2
wangdayong992013-12-29 18:41
把return 0语句去掉
#3
rjsp2013-12-30 08:33
C++/CLI 和 C++ 毫无关系,你最好到.net论坛去问
#4
IceSource2013-12-30 08:41
你试一下Ctrl+F5运行
1