我如何使用C ++来解决这个问题? [英] HOW DO I DO THIS QUESTION BY USING C++?

查看:67
本文介绍了我如何使用C ++来解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

体检医师到达犯罪现场并取出死者的温度T_i。一小时后,体检医师再次获取死者的温度T_f。检查员注意到房间内的恒温器设定为恒定的T_a温度。根据这些数据和牛顿冷却定律,设计,编写,编译,运行和调试一个程序,该程序从用户接收(使用cin)温度T_i,T_f和T_a华氏度,并显示那些温度,常数k和近似值个人死亡与检查者到达之间的时间长度t_h(假设个体的体温在死亡时为T_d = 98.6华氏度)。



步骤1:从以下公式确定常数k:k =( - log((T_f - T_a)/(T_i - T_a)))/ 1.0

步骤2:从以下小时确定t_h:t_h =( - log((T_i - T_a)/(T_d - T_a)))/ k

步骤3:打印出t_h的值几个小时。





没关系,所以我尽了最大努力但答案却给了我'好像是一个正确的答案.....我不确定我做错了什么



The medical examiner arrives at the crime scene and takes the temperature, T_i, of the deceased. An hour later the medical examiner again takes the temperature T_f of the deceased. The examiner notices that the thermostat in the room is set for a constant T_a temperature. From this data and Newton's Law of Cooling, design, write, compile, run and debug a program that takes in (use cin) temperatures T_i, T_f and T_a in degrees Fahrenheit from the user and displays those temperatures, constant k, and the approximate length of time t_h in hours between the death of the individual and the arrival of the examiner (assume the individual's body temperature was T_d = 98.6 degrees Fahrenheit at the time of death).

Step 1: Determine constant k from: k = (-log((T_f - T_a)/(T_i - T_a)))/1.0
Step 2: Determine t_h in hours from: t_h = (-log((T_i - T_a)/(T_d - T_a)))/k
Step 3: Print out the value of t_h in hours.


okay, so I did my best but the answer it gives me don't seem like a right answer..... Im not sure if I did something wrong

#include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

int main()
{

double T_i,T_f,T_a,k,T_h;
const double T_d = 98.6;

cout<<	 "Determine length of time t_h in hours between the death of the individual and the arrival of the examiner "<<endl<<endl;

cout<< "Enter the value of T_i: ";
cin>> T_i;
cout<< "Enter the value of T_f: ";
cin>> T_f;
cout<< "Enter the value of T_a: ";
cin>> T_a;
k = (-log((T_f - T_a)/(T_i - T_a)))/1.0;
T_h = (-log((T_i - T_a)/(T_d - T_a)))/k;

cout<< setiosflags(ios::fixed)
<< setiosflags(ios::showpoint)
<< setprecision(4)
<< "time between the death of the individual and the arrival of the examiner:"<<T_h<< "hours"<<endl;


return 0;


}

推荐答案

这是作业。

我们不要为你做功课。

为什么?因为它没有帮助



试一试。

按照你的课程笔记。



如果您遇到问题,请发布一个问题,其中包含您尝试过的代码以及您遇到困境的详细信息。



我们非常乐意为您提供帮助......但只有您尝试
This is homework.
We don't do your homework for you.
Why? Because it doesn't help you.

Give it a try.
Follow your course notes.

When you get stuck, then post a question that includes the code you have tried and details of where you are stuck.

We are more than happy to help ... but only if you try


这篇关于我如何使用C ++来解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆