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
Which of the following is not a type of bank?
andreyandreev [35.5K]
Where is the following banks that is listed?
3 0
2 years ago
Read 2 more answers
Read the excerpt from Act 111, scene iii of Romeo and Juliet. Which is the best paraphrase of this dialogue
Rufina [12.5K]
I think that D is the answer
8 0
3 years ago
Write a valid HTML + Python page that will count numbered from 1 to 1,000,000?​
valentinak56 [21]

Answer:

I remember before the corona virus we used to do math at school

8 0
3 years ago
Inattentional blindness occurs when individuals do not observe certain objects or events because they are focused on something e
PSYCHO15rus [73]
The answer is True have a good day
5 0
3 years ago
Read 2 more answers
Now the y0utube home screen is gone
erik [133]

Answer:

oh no thanks not good

Explanation:

did you try it on a different device mabye a phone

7 0
3 years ago
Read 2 more answers
Other questions:
  • Why are video texts an example of multimedia? A. They use audio and visual elements together. B. They use one type of medium to
    13·2 answers
  • How would you describe enterprise computing
    12·1 answer
  • "PindCart, an online retailer, places a small file on the computer hard drive of its visitors to recognize them when they revisi
    7·1 answer
  • Give two separate print statements: one will print your name, the other will print your major. Ensure that both will print on th
    15·1 answer
  • Which CSS attribute would change an element's font color to blue? font-color: blue; background: blue; color: blue; background-co
    10·2 answers
  • Reversing the elements of an array involves swapping the corresponding elements of the array: the first with the last, the secon
    6·1 answer
  • Write a class Bug that models a bug moving along a horizontal line. The bug moves either to the right or left. Initially, the bu
    7·1 answer
  • What is the second step when designing an algorithm?
    12·2 answers
  • What are two differences between a wide angle lens and a telephoto lens?
    5·2 answers
  • Which example best demonstrates an impact of computers on the economy?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!