首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

上面这个代码出现invalid use of member (did you forget the `&' ?) 异常是什么意思

2012-09-23 
下面这个代码出现invalid use of member (did you forget the `& ?) 错误是什么意思啊#includeiostream

下面这个代码出现invalid use of member (did you forget the `&' ?) 错误是什么意思啊
#include<iostream>
#include<vector>
#include<string>
#include<cctype>
using namespace std;
int main(){
  vector<string> svec;
  string str;
  cout<<"Enter text(Ctrl+Z to end):"<<endl;
  while(cin>>str)
  svec.push_back(str);
  if(svec.size()==0){
  cout<<"no strings?"<<endl;
  return -1;  
  } 
  cout<<"Transformed elements frome the vector:"
  <<endl;
   
  for(vector<string>::size_type ix=0;ix!=svec.size();++ix){
  for(string::size_type index=0;index!=svec[ix].size;++index)\\错误在这一行
  if(islower(svec[ix][index])
  svec[ix][index]=toupper(svec[ix][index]);
  cout<<svec(ix)<<" ";
  if((ix+1)%8==0) cout<<endl;
  }
  system("pause");
  return 0;
}
 

[解决办法]
for(string::size_type index=0;index!=svec[ix].size();++index)

热点排行