C++大写到小写~~急急急~~谢谢~~啊

来源:百度知道 编辑:UC知道 时间:2024/06/06 17:10:56
#include <string>
#include <iostream.h>
#include <vector>

using namespace std;

using std::string;
using std::vector;

int main()
{
cout<<"enter your words:";
vector<string>words;
string x;
while(cin>>x)
words.push_back(x);
int size=words.size();
int i,j;
for(i=0;i<words.size;i++){
for(j=0;j<size;j++)
{
if(x[j]>='a'&&x[j]<='z')
x[j]=x[j]-32;
else if(x[j]>='A'&&x[j]<='Z')
x[j]=x[j]+32;
else
cout<<"error"<<endl;}
cout<<words[i]<<endl; }
}}
输入一句话 把大写变成小写 总是有错误 可是不知道哪里有问题啊 思路没问题啊
错误如下

nts and settings\administrator\桌面\qianqian\qian2.cpp(15) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of

for(i=0;i<words.size;i++)中的size后面少了对括号。你上面有这里没有
还有最后多了个大括号。
还有就是逻辑上有错。
编绎上的错误就是这些,至于逻辑上的错语。。。我无语

大小写转换而已,看看ASSIC码,判断下是什么字符,之后转换成什么就可以了,用CHAR
用数组,必须用cout<<么?

感觉是不是您头文件出的问题。。。