| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 464 人关注过本帖
标题:为什么书上的示范程序在Dev-C++4,9,9,2上运行不了呢,求指教
只看楼主 加入收藏
xiuzhexin
Rank: 1
等 级:新手上路
帖 子:3
专家分:1
注 册:2012-3-1
收藏
 问题点数:0 回复次数:2 
为什么书上的示范程序在Dev-C++4,9,9,2上运行不了呢,求指教
#include<iostream>
using namespace std;
int main()
{
    int number_of_pods,peas_per_pod,total_peas;
    cout<<"Press return after entering a number./n";
    cout<<Enter the number of pods:/n";
    cin>>number_of_pods;
    cout<<"Enter the number of peas in a pod:/n";
    cin>>peas_of_pods;
    total_peas=number_of_pods*peas_of_pod;
    cout<<"If you have";
    cout<<number_of_pods;
    cout<<"pea pods/n";
    cout<<"and";
    cout<<peas_of_pod;
    cout<<"peas in each pod,then/n";
    cout<<"you have";
    cout<<total_peas;
    cout<<"peas in all the pods./n";
    return 0
}


代码如上 谢谢。。 我是新手 分少给点了。。
搜索更多相关主题的帖子: entering include return 
2012-03-02 19:43
yuccn
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:何方
等 级:版主
威 望:167
帖 子:6815
专家分:42393
注 册:2010-12-16
收藏
得分:0 
编译都不会通过 别说运行

最后一个return 你确定有分号吗?

我行我乐
公众号:逻辑客栈
我的博客:
https://blog.yuccn. net
2012-03-03 08:37
RegKiller
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-10
收藏
得分:0 
#include<iostream>
using namespace std ;
int main()
{
    int number_of_pods,peas_of_pods,total_peas ;
    cout<<"Press return after entering a number.\n" ;
    cout<<"Enter the number of pods :\n ";
    cin>>number_of_pods ;
    cout<<"Enter the number of peas in a pod:\n" ;
    cin>>peas_of_pods ;
    total_peas=number_of_pods*peas_of_pods ;
    cout<<"If you have" ;
    cout<<number_of_pods ;
    cout<<"pea pods\n" ;
    cout<<"and" ;
    cout<<"peas_of_pod" ;
    cout<<"peas in each pod,then\n" ;
    cout<<"you have" ;
    cout<<total_peas ;
    cout<<"peas in all the pods.\n" ;
    return 0 ;
}
2012-03-03 08:39
快速回复:为什么书上的示范程序在Dev-C++4,9,9,2上运行不了呢,求指教
数据加载中...
 
   



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

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