1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
julia-pushkina [17]
3 years ago
15

Write a program totake a depth (in kilometers) inside the earth as input data;compute

Computers and Technology
1 answer:
lions [1.4K]3 years ago
5 0

Answer:

#include<iostream>

using namespace std;

//define function to calculate the temperature in Celsius

float celsius_at_depth(float depth){

   float celsius = 10 * (depth) + 20;  //formula for calculation

   return celsius;

}

//define function to calculate the temperature in Fahrenheit

float fahrenheit(float celsius){

   float fahrenheit = 1.8 * (celsius)+ 32;//formula for calculation

   return fahrenheit;

}

//main function program start from here

int main(){

   //initialization

   float depth;

   print message

   cout<<"Please enter the depth (in kilometers): ";

   cin>>depth;

   float cel = celsius_at_depth(depth);  //Calling the function

   float feh = fahrenheit(cel);      //Calling the function

   //print the outputs

   cout<<"The Celsius temperature at depth in km: "<<cel<<endl;

   cout<<"The temperature in Fahrenheit is: "<<feh<<endl;

}

Explanation:

Create function celsius_at_depth with return type float and a parameter. This function takes the value depth from the calling function and calculate the temperature in Celsius and then returns the result to the calling function.

create the second function Fahrenheit with return type float and with one parameter. This function takes the temperature input in Celsius and convert into Fahrenheit and then return to the calling function.

Create the main function and declare the variable.

print the message for the user and store the value enter by the user by using the instruction cin.

then, calling the function and store the return outputs.

Finally, print the output.  

You might be interested in
What is stored in alpha after the following code executes?int[] alpha = new int[5];int j;for (j = 0; j &lt; 5; j++){alpha[j] = j
Brut [27]

Answer:

Option A.

Explanation:

5 0
3 years ago
science and technology are interdependent advances in one lead to advances in the other. give an example of this phenomenon.
goblinko [34]
Wouldn't it Be Stem ? 
Science 
technology
Engineering 
Mathmatics 
5 0
4 years ago
You have recently been hired as the staff attorney at a growing independent film studio in Van Nuys, California. Among your duti
expeople1 [14]

Answer: dude it’s all mussed in where the question

Explanation:

4 0
3 years ago
In Microsoft word you can access the ______ command from "mini toolbar"
Mashcka [7]
Redo command, i think.
8 0
3 years ago
Read 2 more answers
How to convert meters to centimeters in c programming​
mote1985 [20]

Answer:

Input

Enter length in centimeter = 1000

Output

Length in meter = 10 m

Length in kilometer = 0.01 km

Explanation:

hope this helps

5 0
3 years ago
Other questions:
  • Under what category of programs and apps do databases and enterprise computing fall?
    8·1 answer
  • Splunk In most production environments, _______ will be used as the source of data input?
    12·1 answer
  • Which of these is an effective color scheme?
    14·1 answer
  • How can the New command be added to the Quick Access Toolbar? Check all that apply.
    9·1 answer
  • Universal Containers wants line items to be organized into pre-defined groups on the output document. The name of these pre-defi
    6·1 answer
  • Which of the following describes cloud computing?​
    10·1 answer
  • A hot site consists of computers, devices, and connectivity necessary to rebuild a network exist, but without appropriate config
    11·1 answer
  • Who need best OCR app . I will help you.​
    10·1 answer
  • If we live 4000 meters from the fire hydrant, how many kilometers away do we live?
    6·2 answers
  • What will be the output of the following HLOOKUP formula on the table?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!