| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 734 人关注过本帖
标题:温度测试程序有问题请教!
只看楼主 加入收藏
含笑半步颠
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-2-27
收藏
 问题点数:0 回复次数:5 
温度测试程序有问题请教!

// temperature conversion application
#include <iostream.h>
void main()
{
// input temperature, numeric input
int tempinput;
// output temperature, numeric output
int tempoutput;
// input conversion type, single character
// "C" will be used to represent C to F.
// "F" will be used to represent F to C.
char conversiontype;
// input the temperature
cin >> tempinput;
// input conversion type
cin >> conversion type;
// conditionals below
if (conversiontype == 67)
// calculation code here for C to F
tempoutput = (1.8 * tempinput) + 32;
if (conversiontype == 70)
// calculation code here for F to C
tempoutput = (tempinput - 32) * 0.555;
cout << tempout << endl;
}

vc++ 6.0上输出有错
1 error(s), 0 warning(s)
但是我检查了多次不知道错在哪!?
请多指教

[此贴子已经被作者于2007-3-7 22:25:22编辑过]

搜索更多相关主题的帖子: temperature input 温度 conversion 
2007-03-05 21:15
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
收藏
得分:0 
cin >> conversion type;
cin >> conversiontype;

[glow=255,red,2]wfpb的部落格[/glow] 学习成为生活的重要组成部分!
2007-03-05 21:38
虫虫飞ya飞
Rank: 1
等 级:新手上路
帖 子:122
专家分:0
注 册:2005-11-28
收藏
得分:0 
#include<iostream.h>
void main()
{

int tempinput;

double tempoutput;

int conversiontype;

cin>>tempinput;

cin>>conversiontype;

if(conversiontype==67)

tempoutput=(1.8*tempinput)+32;

if(conversiontype==70)

tempoutput=(tempinput-32)*0.555;

cout<<tempoutput<<endl;

}
上面是正确呢,你自己慢慢对着看吧你错的不止一个地方.

2007-03-07 16:18
含笑半步颠
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-2-27
收藏
得分:0 
哦~ 谢谢!
2007-03-07 22:23
skybehind
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-3-1
收藏
得分:0 

哦..

2007-03-08 15:57
shizhusz110
Rank: 1
等 级:新手上路
帖 子:307
专家分:0
注 册:2006-12-21
收藏
得分:0 
tempoutput做成double好点
2007-03-08 20:35
快速回复:温度测试程序有问题请教!
数据加载中...
 
   



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

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