C++ 命令输入简单算法的实现

#include <vector>
#include <boost/progress.hpp>
#include <boost/thread.hpp>
#include <Windows.h>
#include <map>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <sstream>
#include <iostream>

#include <hash_map>

#include "CSHOW.H"
using namespace boost;
using namespace std;


extern int num;
int main()
{
string command ;
while(true)
{
command.empty();
cout << ">" ;
char ch;
while( 0x0A != (ch =getchar()) )
{
command.insert(command.end(),ch);
}

if (command == "show")
{
cout << "show" << endl;
}
else if(command == "display")
{

cout << "display" << endl;
}
else if("exit" == command)
{

exit(0);
}
else
{
cout << "command invalid" << endl;
}
}
int wait;
cin >> wait;
}

posted @ 2013-07-01 21:08  Predator  阅读(263)  评论(0编辑  收藏  举报