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
To create a default value for a parameter in the parameter list of a function, you code a/an ________________ sign after the par
Y_Kistochka [10]
Assigning a default value to parameter makes it optional and such must come last in the list. example (c#):

void GetStudents(string gender, int page=1, int size = 10){

// body
}
In the above example, gender is a required while page and size are optional.
4 0
3 years ago
What is the difference between a master device in a Bluetooth network and a base station in an 802.11 network?
spayn [35]

Answer:

In an 802.11, a master device in a bluetooth network organize themselves into a "Piconet" of up to 8 slave devices. In an 802.11, a base station is a receiver and transmitter that plays a role of the WIFI network.

Explanation:

802.11 is the original wireless specification and it was developed by IEEE. IEEE stands for Institute of Electrical and Electronic Engineers (IEEE).

In an 802.11, a master device in a bluetooth network organize themselves into a "Piconet" of up to 8 slave devices. In an 802.11, a base station is a receiver and transmitter that plays a role of the WIFI network.

7 0
3 years ago
. Write at least three benefits of using a network.​
Annette [7]

Answer:

Advance your career

Gain more knowledge

And have another way to talk to your friends especially during the pandemic

3 0
3 years ago
Multiple layers provide multiple road blocks for a ________.
Hatshy [7]

Individual or other words user and attackers

4 0
4 years ago
What is File Allocation Table
vichka [17]
It's how you format your hard drive
4 0
3 years ago
Read 2 more answers
Other questions:
  • What are three situations when recursion is the only option available to address problems?
    10·1 answer
  • You are in charge of the IT division for a company that has 1,048,576 customers. Your boss asks you to decide between buying a d
    14·1 answer
  • Where can I easily find an easy app or program to use for making/editing videos?
    13·1 answer
  • The GeForce GTX 1060 graphics card requires 120 W of power. You plan to install it in a PCIe 3.0 ×16 slot. Will you need to also
    13·1 answer
  • Consider the markets for monitors, USB drives, central processing units, and Microsoft’s Windows. Assume monitor manufacturers u
    7·1 answer
  • Given an initialized String variable outfile, write a statement that declares a PrintWriter reference variable named output and
    12·1 answer
  • Write a recursive function stringReverse that takes a string and a starting subscript as arguments, prints the string backward a
    5·1 answer
  • Choose the item which best describes the free frame list. 1. a per process data structure of available physical memory 2. a glob
    7·1 answer
  • Fill _________ skips the Saturday and Sunday dates in a date fill.
    10·1 answer
  • What is the term of illegal copy of software?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!