Created
May 2, 2010 12:53
-
-
Save johnhmj/387105 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
// Integrated Development Environment | |
// Visual C++ | |
using namespace std; | |
// 利用 STL vector | |
typedef vector<string> Vstr; | |
// | |
void main(int argc, char** argv) | |
{ | |
string _buffer_string; | |
Vstr vstr; | |
while ( 1 ) | |
{ | |
cout<<"Input your name: ", cin>>_buffer_string; | |
// 輸入 -1 即跳出程式 | |
if ( _buffer_string.compare("-1") == 0 ) | |
{ | |
break; | |
} | |
vstr.push_back(_buffer_string); | |
} | |
for (size_t i = 0; i < vstr.size(); i ++) | |
{ | |
cout<<(i + 1)<<". "<<vstr[i]<<endl; | |
} | |
system("PAUSE"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment