#include <iostream>
#include <string>
#include <vector>
#include <cctype>
using namespace::std;
/*练习3.17:从cin读入一组词并把他们存入一个vector对象,
然后设法把所有词都改为大写形式。输出改变后的结果,每个词占一行。*/
int main()
{
vector<string> v1 (5); //定义5个容器
for(string &arr:v1) //依次将数据存入5容器
{
cin>>arr;
}
cout<<""<<endl; //手动分割
if(v1.size()!=0)
{
cout<<"No error"<<endl; //检测数据是否存在
for(string &arr:v1) //依次将容器中的数据导出
{
for(char &temp:arr)
{
toupper(temp);
}
cout<<arr<<endl;
}
}
return 0;
}
temp=toupper(temp);
试试