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

string定义数据,无法输入输出, 为什么解决方案

2012-02-07 
string定义数据,无法输入输出, 为什么代码如下:#include iostream#include string#includestdafx.h

string定义数据,无法输入输出, 为什么
代码如下:  
#include <iostream>  
#include <string>  
#include   "stdafx.h "  

using   namespace   std;  

void   main()  
{  
string   word;  

cin> > word;  
cout < <word;  
getchar();  
return   ;  
}  
编译后报错:  
hello.cpp(13)   :   error   C2679:   二进制“> > ”   :   没有找到接受“”类型的右操作数的运算符(或没有可接受的转换)  
hello.cpp(14)   :   error   C2679:   二进制“ < <”   :   没有找到接受“”类型的右操作数的运算符(或没有可接受的转换)  

不知道到底是哪出的错我用的是.net   2003,望各位高手指点

[解决办法]
这样顺序包含头文件
#include "stdafx.h "
#include <iostream>
#include <string>

热点排行