vector类字符串元素输出变大写
程序如下:
#include <iostream>
#include <string.h>
#include <cctype>
#include <vector>
using namespace std;
int main(int argc, const char * argv[])
/*
**输入文本
*/
{
vector<string> article;
string word;
cout<<"please enter the article:"<<endl;
while (cin>>word) {
article.push_back(word);
}
/*
**置空标点
*/
/*for (vector<string>::size_type n=0; n!=article.size(); ++n) {
for (string::size_type j=0; j<=article[n].size(); ++j) {
if (ispunct(article[n][j])) {
article[n][j]=NULL;
}
article[n][j]=article[n][j]-32;
}
}*/
for (vector<string>::size_type n=0; n!=article.size(); ++n) {
cout<<" "<<article[n]<<" ";
}
}
输出结果如下:
please enter the article:
SS SS
求解释啊~~~
vector
[解决办法]
你的键盘按下了 capslock 键