| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 468 人关注过本帖
标题:求解,这代码在vC6.0中运行不起来,明明是按书上一行一行抄下来的。
只看楼主 加入收藏
夜十天
Rank: 1
等 级:新手上路
帖 子:32
专家分:7
注 册:2013-5-8
结帖率:62.5%
收藏
已结贴  问题点数:20 回复次数:4 
求解,这代码在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)
求大神。
搜索更多相关主题的帖子: another include letter Enter 
2013-11-09 11:06
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9007
专家分:53942
注 册:2011-1-18
收藏
得分:5 
什么鸟书会写 #include "stdafx.h" ?
什么鸟书会写 #include "iostream" 而不是 #include <iostream> ?
什么鸟书会写 cout<<"The ghird letter in"<<str2<<"is">>str2[2]<<endl; ?
2013-11-09 12:08
peach5460
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:武汉
等 级:贵宾
威 望:30
帖 子:2780
专家分:6060
注 册:2008-1-28
收藏
得分:5 
以下是引用rjsp在2013-11-9 12:08:08的发言:

什么鸟书会写 #include "stdafx.h" ?
什么鸟书会写 #include "iostream" 而不是 #include  
什么鸟书会写 cout<<"The ghird letter in"<>str2[2]<

+1

我总觉得授人以鱼不如授人以渔...
可是总有些SB叫嚣着:要么给代码给答案,要么滚蛋...
虽然我知道不要跟SB一般见识,但是我真的没修炼到宠辱不惊...
2013-11-09 13:19
blueskiner
Rank: 8Rank: 8
等 级:蝙蝠侠
帖 子:227
专家分:707
注 册:2008-9-22
收藏
得分:5 
以下是引用rjsp在2013-11-9 12:08:08的发言:

什么鸟书会写 #include "stdafx.h" ?
什么鸟书会写 #include "iostream" 而不是 #include <iostream> ?
什么鸟书会写 cout<<"The ghird letter in"<<str2<<"is">>str2[2]<<endl; ?

+1
2013-11-09 13:32
左手拉一只猫
Rank: 4
来 自:杭州
等 级:业余侠客
帖 子:70
专家分:250
注 册:2013-10-27
收藏
得分:5 
回复 2楼 rjsp
+1

我能帮你的只能到这里了。。。
2013-11-09 15:08
快速回复:求解,这代码在vC6.0中运行不起来,明明是按书上一行一行抄下来的。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016792 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved