main.cpp

来自「一个由Mike Gashler完成的机器学习方面的includes neural」· C++ 代码 · 共 64 行

CPP
64
字号
// --------------------------------------------------------
// This demo file is dedicated to the Public Domain. See:
// http://creativecommons.org/licenses/publicdomain
// --------------------------------------------------------

#include "MainMenu.h"
#include "Gui.h"
#include <time.h>
#include "../GClasses/GApp.h"
#ifdef WIN32
#	include <windows.h>
#endif

void ShowWafflesMainMenu()
{
	MainMenuController c;
	c.RunModal();
}

void printUnicodeError(const wchar_t* wszError)
{
	ConvertUnicodeToAnsi(wszError, szError);
#ifdef WIN32
	wprintf(L"%ls\n", wszError);
	MessageBox(NULL, szError, "Waffles -- Unhandled Exception", MB_ICONEXCLAMATION);
#else
	printf("%s\n", szError);
#endif
}

int main(int argc, char *argv[])
{
	// Seed the random number generator
	time_t t;
	srand((unsigned int)time(&t));

	// Exceptions are better than signals
	GApp::TurnSegFaultsIntoExceptions();

	// Find the app path
	ControllerBase::SetAppPath(GApp::GetApplicationPath(argv[0]));

	// Show the main menu
	try
	{
		ShowWafflesMainMenu();
	}
	catch(const char* szError)
	{
		printf("%s\n", szError);
#ifdef WIN32
		MessageBox(NULL, szError, "Waffles -- Unhandled Exception", MB_ICONEXCLAMATION);
#endif
	}
	catch(const wchar_t* wszError)
	{
		printUnicodeError(wszError);
	}

	return 0;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?