By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,131 Members | 2,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,131 IT Pros & Developers. It's quick & easy.

hi there, ca you help me please

P: 12
I am supposed to write a program to take a depth (in kilometers) inside the earth as input data; compute and display the temperature at this depth in degree Celsius and degree Fahrenheit. The relevant formula are
- Celcius = 10 (depth) + 20 (Celsius temperature at depth in Km)
- Fahrenheit = 1.8 (Celsius) + 32
Include two functions in your programs. Function CelsiusAtDepth should compute and return the Celsius temperature at a depth measured in Km. Function Fahrenheit should convert a Celsius temperature to Fahrenheit
Nov 5 '06 #1
Share this Question
Share on Google+
1 Reply


seeminsuleri
P: 9
hey there,
following is the C++ code for it. but there is one ambiguity in it. you have written the formula for calculating the Celcius as under:
Celcius = 10 (depth) + 20 (Celsius temperature at depth in Km)
But i dont get where will this "Celcius Tempertaure at Depth" Come from?
will u take it from the user as well?because i think ur program is only taking depth as an input from the user!

just clear this and i will complete the CelciusAtDepth Function for u. For now here goes ur remaining code!

#include<stdio.h>
#include<math.h>
#include<conio.h>
using namespace std;

float CelciusAtDepth(float);
float Fahrenheit(float);
void main()
{
float depth,Celcius,Fahren;
cout<<"Enter the depth"<<endl;
cin>>depth;
Celcius=CelciusAtDepth(depth);
cout<<"The Temperature in Celcius is "<<Celcius<<endl;
Fahren=Fahrenheit(Celcius);
cout<<"The Temperature in Fahrenheit is "<<Fahren<<endl;
return 0;
}

float CelciusAtDepth(float Cel)
{
// To be completed...
}

float Fahrenheit(float C)
{

float x;
x=1.8*C;
x=x+32;
return x;

}


I am supposed to write a program to take a depth (in kilometers) inside the earth as input data; compute and display the temperature at this depth in degree Celsius and degree Fahrenheit. The relevant formula are
- Celcius = 10 (depth) + 20 (Celsius temperature at depth in Km)
- Fahrenheit = 1.8 (Celsius) + 32
Include two functions in your programs. Function CelsiusAtDepth should compute and return the Celsius temperature at a depth measured in Km. Function Fahrenheit should convert a Celsius temperature to Fahrenheit
Nov 5 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.