page180

// page180.cpp : 定义控制台应用程序的入口点。
//C++面向对象程序设计
//这个程序将华氏温度换为摄氏温度

#include "stdafx.h"
#include <iostream>

void initialize_screen();
//将当前输出与上一个程序的输出分开

double celsius(double fahrenheit);
//将华氏温度算为摄氏温度

void show_results(double f_degrees , double c_degrees);
//显示输出,假定摄氏温度c_degrees等于华氏温度f_degrees

 

int _tmain(int argc, _TCHAR* argv[])

 using namespace std ;
 double f_temperature , c_temperature ;

 //initialize_screen();---这个没弄懂 , 要不要都无所谓啊???????---//将当前输出与上一个程序的输出分开---从程序看是换行
 cout << " I will convert a Fahrenhelt temperature "
  << " to Celsiud .\n"
  << " Enter a temperatuer in Fahrenhit: ";
 cin >> f_temperature;

 c_temperature = celsius(f_temperature);

 show_results(f_temperature , c_temperature);

 cin >> c_temperature;
 return 0;
}


//函数定义使用了iostream;
void initialize_screen()
{
 using namespace std ;
 cout <<  endl;
 return ;
 //可选- 无返回值
}


double celsius(double fahrenheit)
{
 return ((5.0/9.0) * (fahrenheit-32));

}


//函数定义使用iostream
void show_results(double f_degrees , double c_degrees)
{
 using namespace std ;
 cout.setf(ios::fixed);
 cout.setf(ios::showpoint);
 cout.precision(2);
 cout << f_degrees
  << " degrees Fahrenheit is equivalent to \n"
  << c_degrees << " degrees Celsius.\n";
 return ;
 //return 这是可选的---无返回值

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值