请高手指教!
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
using std::cin;
using std::vector;
using std::cout;
using std::endl;
using std::string;
int main ()
{string word;
int counter=0,i=0,n=0;
vector<string>text;
while(cin>>word)
{text.push_back(word);++counter;
}
for (i=0;i!=text.size();++i)
{text[i]=toupper(text[i]);
}
for (n=1;n%8!=0;++n)
{cout<<text[n-1]<<endl;
}
return 0;
}
程序如上,要解决的问题是读入一段文本,每个单词存为一个元素,再把每个单词转化为大写字母,输出转化后的元素.每8个一行输出.
E:\wrong\word out.cpp(18) : error C2664: 'toupper' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
我现在有个疑问是我的输出是否正确,不清楚每8个单词输出怎么编写程序,请高手帮忙,谢谢了