| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 652 人关注过本帖
标题:向各位请教!此程序到底哪里错了??
只看楼主 加入收藏
我为C痴
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2007-8-31
收藏
 问题点数:0 回复次数:9 
向各位请教!此程序到底哪里错了??
//程序:AVERAGE.CPP
//功能:求数、理、化三科平均成绩的总评,演示if语句嵌套的缩进形式。
#include<iostream.h>
void main()
{
int math,phys,chem;
int average;
float scholarship;
cout<<"Enter scores of math.,phys.and chem.:";
cin>>math>>phys>>chem;
average=(math+phys+chem)/3.0+0.5;
if(average>=90){
cout<<"Excellt.\n";
scholarship=120.00;
}else if(average>=80){
cout<<"Good.\n";
scholarship=85.00;
}else if(average>=70){
cout<<"Average.\n";
scholarship=55.00;
}else if(average>=60){
cout<<"Pass.\n";
scholarship=45.50;
}else{
cout<<"Fail.\n";
scholarship=0.00;
}
cout<<"Your scholarship is"<<sholarship<<".\n";
}
这个程序哪里出错啦。。。不能编译出来 找了好久没发现啊
搜索更多相关主题的帖子: average include scores Enter 
2007-10-10 19:22
Janlex
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:303
专家分:0
注 册:2006-9-12
收藏
得分:0 
#include<iostream.h>
void main()
{
int math,phys,chem;
double average;
float scholarship;
cout<<"Enter scores of math.,phys.and chem.:";
cin>>math>>phys>>chem;
average=(math+phys+chem)/3.0+0.5;
if(average>=90){
cout<<"Excellt.\n";
scholarship=120.00;
}else if(average>=80){
cout<<"Good.\n";
scholarship=85.00;
}else if(average>=70){
cout<<"Average.\n";
scholarship=55.00;
}else if(average>=60){
cout<<"Pass.\n";
scholarship=45.50;
}else{
cout<<"Fail.\n";
scholarship=0.00;
}
cout<<"Your scholarship is"<<scholarship<<".\n";
}

★★★★★欢迎光临我的博客 ★★★★★
http://www.
2007-10-10 19:39
succubus
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:4
帖 子:635
专家分:1080
注 册:2007-10-7
收藏
得分:0 
cin>>math>>phys>>chem

[url=http:///view/aDU1]/image/aDU1.gif" border="0" />[/url]
2007-10-10 20:42
我为C痴
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2007-8-31
收藏
得分:0 
好像不是楼上两位大哥说的那样啊!!!
2007-10-14 18:56
xjlsgcjdtc
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2007-9-4
收藏
得分:0 
回复:(我为C痴)好像不是楼上两位大哥说的那样啊!!...
double average;

String me = "program"
2007-10-14 21:13
Standford
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-10-5
收藏
得分:0 
#include<iostream.h>
void main()
{
int math,phys,chem;
int average;
float scholarship;
cout<<"Enter scores of math.,phys.and chem.:";
cin>>math>>phys>>chem;// 源文件中,此处的分号输入法不对
average=(math+phys+chem)/3.0+0.5;
if(average>=90){
cout<<"Excellt.\n";
scholarship=120.00;
}else if(average>=80){
cout<<"Good.\n";
scholarship=85.00;
}else if(average>=70){
cout<<"Average.\n";
scholarship=55.00;
}else if(average>=60){
cout<<"Pass.\n";
scholarship=45.50;
}else{
cout<<"Fail.\n";
scholarship=0.00;
}
cout<<"Your scholarship is"<<scholarship<<".\n";// scholarship打成sholarship
}

2007-10-16 00:09
小魔王星
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-10-16
收藏
得分:0 
#include<iostream.h>
void main()
{
int math,phys,chem;
double average;//int average;
float scholarship;
cout<<"Enter scores of math.,phys.and chem.:";
cin>>math>>phys>>chem;//cin>>math>>phys>>chem;
average=(math+phys+chem)/3.0+0.5;
if(average>=90){
cout<<"Excellt.\n";
scholarship=120.00;
}else if(average>=80){
cout<<"Good.\n";
scholarship=85.00;
}else if(average>=70){
cout<<"Average.\n";
scholarship=55.00;
}else if(average>=60){
cout<<"Pass.\n";
scholarship=45.50;
}else{
cout<<"Fail.\n";
scholarship=0.00;
}
cout<<"Your scholarship is"<<scholarship<<".\n";//cout<<"Your scholarship is"<<sholarship<<".\n";
}

2007-10-17 06:46
小魔王星
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-10-16
收藏
得分:0 

但是不懂运行结果
LZ教下


2007-10-17 06:47
a217zxg
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2007-10-20
收藏
得分:0 
   有算术运算的话,都应该是double型吧
2007-10-21 10:18
king86
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-10-10
收藏
得分:0 
LZ的程序最后sholarship还写错了
2007-10-24 15:11
快速回复:向各位请教!此程序到底哪里错了??
数据加载中...
 
   



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

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