游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1994|回复: 6

C++pirper plus中的题目

[复制链接]

29

主题

153

帖子

189

积分

注册会员

Rank: 2

积分
189
发表于 2005-9-30 02:54:00 | 显示全部楼层 |阅读模式
编写一个C++程序,其中的mian()调用一个用户定义的函数(以摄氏温度值为参数,并返回相应的华氏温度),该程序按下面的格式要求用户输入摄氏温度值,并显示结果:
P;ease enter a Celsius value: 20
20 degrees Celsiusis 68 degrees Fahrenheit.
华氏温度=1.8*摄氏温度+32.0
--------------
请问该怎么编写?

2

主题

35

帖子

44

积分

注册会员

Rank: 2

积分
44
发表于 2005-9-30 04:57:00 | 显示全部楼层

Re:C++pirper plus中的题目

这个。。。
你可以看看关于iostream的介绍,对cin,cout的使用,就解决了。

3

主题

105

帖子

105

积分

注册会员

Rank: 2

积分
105
发表于 2005-9-30 09:19:00 | 显示全部楼层

Re:C++pirper plus中的题目

    网上可以找到C++Primer 的答案的书的,楼主可以参考啊

85

主题

824

帖子

878

积分

高级会员

Rank: 4

积分
878
QQ
发表于 2005-9-30 11:23:00 | 显示全部楼层

Re:C++pirper plus中的题目

现在这个题目很流行吗??前两天一个英语系的MM还叫我帮她写来着~~

248

主题

2674

帖子

2702

积分

金牌会员

Rank: 6Rank: 6

积分
2702
QQ
发表于 2005-10-1 00:41:00 | 显示全部楼层

Re:C++pirper plus中的题目

P;ease enter a Celsius value: 20
20 degrees Celsiusis 68 degrees Fahrenheit.
华氏温度=1.8*摄氏温度+32.0

int dddd(int n)
{
return 1.8 * n * 32.0;
}

29

主题

153

帖子

189

积分

注册会员

Rank: 2

积分
189
 楼主| 发表于 2005-10-1 01:55:00 | 显示全部楼层

Re:C++pirper plus中的题目

#include<iostream>
using namespace std;
double wendu(int);
int main()
{
        int stone;
        cout<<&quotlease enter a Celsius value :"<<endl;
        cin>>stone;
        double pounds=wendu(stone);
        cout<<stone<<"degrees Celsiusis "<<pounds<<" degrees Fahrenheit.\n";
        return 0;
}
double wendu(int sts)
{
       
        return 1.8*sts+32.0;
}
---------
谢谢,已经解决 [em1]

132

主题

1341

帖子

1341

积分

金牌会员

Rank: 6Rank: 6

积分
1341
发表于 2005-10-1 11:34:00 | 显示全部楼层

Re:C++pirper plus中的题目

我9岁用pascal写过这样的程序了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-28 01:27

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表