// Throwing.cpp : main project file.

#include "stdafx.h"

using namespace System;

void func(int a)
{
    if (a <= 0)
        throw gcnew System::ArgumentException("Aaargh! What wrong?");
}

int main(array<System::String ^> ^args)
{
	Console::WriteLine(L"Throw Test");
	try
		{
			int n = 3;
			Console::WriteLine(L"Calling with n = 3");
			func(n);
			Console::WriteLine(L"Calling with n = 0");
			n = 0;
			func(n);
		}
	catch(System::ArgumentException^ pex)
		{
			Console::WriteLine(L"Exception was {0}", pex);
		}
	Console::WriteLine(L"All done");

    return 0;
}