cin,cout 编译错误
idot 2008-03-12 09:29:57 我在vc2005下新建空白工程,在工程下新建代码文件,输入代码如下:
//============================================================================
// Name : covertString.cpp
// Author : wangxiwei
// Version :
// Copyright : skcc
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
int main() {
string inputed;
cin >> inputed;
if( inputed.length() == 0) {
cout << "can not reverse empty string !" << endl;
}
else{
string converted ;
size_t wordStartPos = inputed.rfind(" ",0,inputed.length());
size_t wordEndPos = string::npos;
while ( wordStartPos >= 0){
converted += inputed.substr(wordStartPos,wordEndPos);
cout << converted << endl;
wordStartPos = inputed.rfind(" ",0,wordStartPos);
}
}
return 0;
}
在cin,cout处编译出错,提示c2679错误。为什么?