求解,这代码在vC6.0中运行不起来,明明是按书上一行一行抄下来的。
#include "stdafx.h"#include "iostream"
#include "string"
int main()
{ using namespace std;
char charr1[20];
char charr2[20];
string str1;
string str2="panther";
cout<<"Enter a kind of feline:"<<endl;
cin>>charr1;
cout<<"Enter another kind of feline:"<<endl;
cin>>str1;
cout<<"Here are some felines\n";
cout<<charr1<<" "<<charr2<<" "<<str1<<" "<<str2<<endl;
cout<<"The third letter in"<<charr2<<"is"<<charr2[2]<<endl;
cout<<"The ghird letter in"<<str2<<"is">>str2[2]<<endl;
return 0;
}
这是错误信息提醒:
D:\新建文件夹\Microsoft Visual Studio\MyProjects\999\999.cpp(20) : error C2676: binary '>>' : 'class std::basic_ostream<char,struct std::char_traits<char> >' does not define this operator or a conversion to a type acceptable to the predefined operat
or
执行 cl.exe 时出错.
999.exe - 1 error(s), 0 warning(s)
求大神。