stl
vectorとか復習。
いや、日常的に使っていないので復習。
使えばいいんだよな。。。
無理して使っていくかなって。。。
{ vector<char> v_char; while(1) { char test_in; cin >> test_in; if( 'q' == test_in ) break; if( 'd' == test_in ) { vector<char>::iterator itr = v_char.begin(); vector<char>::iterator itrEnd = v_char.end(); for( ; itr != itrEnd ; itr++ ) { cout << *itr; } cout << endl; continue; } if( 'r' == test_in ) { random_shuffle( v_char.begin(), v_char.end() ); continue; } if( 's' == test_in ) { sort( v_char.begin(), v_char.end() ); continue; } if( 'c' == test_in ) { v_char.clear(); continue; } if( 'e' == test_in ) { if( v_char.empty() ) { cout << "empty." << endl; } continue; } v_char.push_back(test_in); } }