編輯日期:2010-06-23 16:01
第 1 頁 |
Kami 2010-06-23 17:06 回覆:
#include
#include using namespace std; int main(int agrc, char *argv[]) { string command = argv[1], tmp; const string delims(" t|><"); string::size_type bindex, eindex, loc; bindex = command.find_first_not_of(delims); while(bindex != string::npos) { eindex = command.find_first_of(delims, bindex); tmp = command.substr(bindex, eindex-bindex); loc = tmp.find( '.', 0 ); if(isupper(tmp[0]) && (loc == string::npos)) { for(int i=1; i tmp[i] = tolower(tmp[i]); } } cout << tmp << " "; bindex = command.find_first_not_of(delims, eindex); } return 0; } |