main.cpp ¶
~cpp #include <iostream> #include "TestClass.h" using namespace std; const int MAX_CLASS=255; void main() { int intinput; TestClass* makedClass[MAX_CLASS]; int classNumber=0; while(1) { cin >> intinput; if (0==intinput) break; int suchNumber=-1; for (register int i=0; i<classNumber; ++i) { if (intinput==makedClass[i]->GetNumber()) suchNumber=i; } if (-1==suchNumber) { makedClass[classNumber]=new TestClass(intinput); ++classNumber; } else { delete makedClass[suchNumber]; for (register int i=suchNumber+1; i<classNumber; ++i) makedClass[i-1]=makedClass[i]; --classNumber; } } for (register int i=0; i<classNumber; ++i) { delete makedClass[i]; } }