int main(int argc, char** argv) { double tt = clock(); if( argc != 2 ) { cout << "usage: 2pc config_file" << endl; return 0; } CConfig* pConfig = new CConfig(); if(!pConfig->Load(argv[1])) { cout << "failure in opening the config file: " << argv[1] << endl; return 0; } if( pConfig->IsServer() ) { CServer* pServer = new CServer(); pServer->Run(); PrintOutput(pServer->GetOutput()); delete pServer; } else { CClient* pClient = new CClient(); pClient->Run(); PrintOutput(pClient->GetOutput()); delete pClient; } double tt1 = clock(); cout << endl << "elapsed " << (tt1-tt)/CLOCKS_PER_SEC << " seconds." << endl; return 0; }