示例#1
0
int main()
{
	Counter C;
	++C;
	C.display();

	//CountDn D;
	//++D;
	//--D;
	//D.display();

	return 0;
}
int main(int argc, char **argv)
{
	int min, max;

	if (argc!=3)
	{
		cerr << "Uso: " << argv[0] << " *lim_min*  *lim_max*" << endl;
		return 1;
	}
	if (!int_from_string(min, argv[1], dec))
	{
		cerr << "limite inferiore non valido" << endl;
		return 2;
	}
	if (!int_from_string(max, argv[2], dec))
	{
		cerr << "limite superiore non valido" << endl;
		return 3;
	}

	int c=0;
	while (true)
	{
		cout << "creo contatore n. " << ++c << "..." << endl;
		try
		{
			Counter *k = new Counter(min, max);
			k->display();
			cout << "fatto!" << endl;
		}
		catch (exception &e)
		{
			cout << "memoria esaurita." << endl;
			break;
		}
	}

	
	
	
}