#include<iostream>
#include<vector>
#include<string>
using std::string;
using namespace std;
using std::vector;
int main()
{
vector<string> iver;
string word;
cout << "Enter text(Ctrl+Z to end): "<<endl;
while(cin>>word)
iver.push_back(word);
if (iver.size() == 0) {
cout << "No string ! " << endl;
return -1;
}
cout << "Transformed elements from the vector: "
<< endl;
for (vector<string>::size_type i = 0; i != iver.size(); ++i)
{
for (string::size_type ix = 0; ix != iver[i].size(); ++ix)
if (islower(iver[i][ix]))
iver[i][ix] = toupper(iver[i][ix]);
cout << iver[i] << endl;
}
system("pause ");
return 0;
}
为什么去掉system("pause ");之后调试,输入字符串按CTRL+Z控制台窗口秒关。再就是我ctrl+z要按两下并且敲回车才会终止while循环,又是为啥。
#include<vector>
#include<string>
using std::string;
using namespace std;
using std::vector;
int main()
{
vector<string> iver;
string word;
cout << "Enter text(Ctrl+Z to end): "<<endl;
while(cin>>word)
iver.push_back(word);
if (iver.size() == 0) {
cout << "No string ! " << endl;
return -1;
}
cout << "Transformed elements from the vector: "
<< endl;
for (vector<string>::size_type i = 0; i != iver.size(); ++i)
{
for (string::size_type ix = 0; ix != iver[i].size(); ++ix)
if (islower(iver[i][ix]))
iver[i][ix] = toupper(iver[i][ix]);
cout << iver[i] << endl;
}
system("pause ");
return 0;
}
为什么去掉system("pause ");之后调试,输入字符串按CTRL+Z控制台窗口秒关。再就是我ctrl+z要按两下并且敲回车才会终止while循环,又是为啥。