Question

(C++) please explain the steps since I am new Implement a function that takes a temperature...

(C++) please explain the steps since I am new

Implement a function that takes a temperature value in Centigrade and returns the corresponding value in Fahrenheit. Formula: ◦C x 9/5 + 32 = ◦F. For example: 37◦C x 9/5 + 32 = 98.6◦F.

Homework Answers

Answer #1
#include <iostream>

using namespace std;

// function that takes a temperature value in Centigrade and returns the corresponding value in Fahrenheit
double getF(double celsius){
   return ((9.0 / 5.0) * celsius + 32);
}

int main()
{
   double temp;
   cout<<"Enter celcius temperature: ";
   cin>>temp;
   cout<<"F = "<<getF(temp)<<endl;
   return 0;
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In c++ format please Most people know that the average human body temperature is 98.6 Fahrenheit...
In c++ format please Most people know that the average human body temperature is 98.6 Fahrenheit (F). However, body temperatures can reach extreme levels, at which point the person will likely become unconscious (or worse). Those extremes are below 86 F and above 106 F. Write a program that asks the user for a body temperature in Fahrenheit (decimals are ok). Check if that temperature is in the danger zone (for unconsciousness) or not and produce the relevant output shown...
Average temperature of a dog is 37°C, or 98.6°F. A Researcher reported that it was 98.2°F,...
Average temperature of a dog is 37°C, or 98.6°F. A Researcher reported that it was 98.2°F, with a standard deviation of 0.7°F. Assume that the body temperatures in degrees F are normally distributed. If the researchers’ statistics for the mean and standard deviation are correct: i) Calculate the probability the average body temperature of these four dogs is less than 98.5°F. Suppose that a vet nurse takes the body temperature of 10 dogs, none with illness or disease that will...
#9) You are to implement the following function F(A,B,C,D,E,F) which outputs a 1 whenever the binary...
#9) You are to implement the following function F(A,B,C,D,E,F) which outputs a 1 whenever the binary number represented by ABCDE is ODD and 0 otherwise. A is the MSB and E is the LSB. Draw the function F(A,B,C,D,E,F) and show the work that led you to that answer. Since I am not so sadistic as to have you draw the truth table of a 6 variable function and draw the K-map of such a function, you should realize, as a...
(Do this in C++ please and make sure no compile/run errors): I. Write a function that...
(Do this in C++ please and make sure no compile/run errors): I. Write a function that writes a series of random Fahrenheit temperatures and their correspond- ing Celsius temperatures to a tab-delimited file. Use 32 to 212 as your temperature range. From the user, obtain the following: 1. The number of temperatures to randomly generate. 2. The name of the output file. A sample run is included below (you must follow the format provided below): Please enter the name of...
Write a function called dequeue_element(queue, i) that takes a queue called queue and an index of...
Write a function called dequeue_element(queue, i) that takes a queue called queue and an index of an element in the queue, i. This function should get the element at index i of the queue and dequeue it but leave all of the other elements in the original order. The function should then return the dequeued value For example, if queue = [A, B, C, D, E, F, G] and the function is called as: dequeue_element(queue, 2) Once the function is...
C++ Fahrenheit to Celsius Tables Write a program that first asks the user which Temperature scale...
C++ Fahrenheit to Celsius Tables Write a program that first asks the user which Temperature scale conversion he/she would like to perform: 1. Convert F to C 2. Convert C to F 3. Quit What is your choice? Then it asks the user for input for three real number variables: start_temp, end_temp, temp_incr. It will then produce a two column Fahrenheit to Celsius table or a two column Celsius to Fahrenheit table, depending on the choice. For choice 1, the...
C Programming I am trying to also print the frequency and the occurrence of an input...
C Programming I am trying to also print the frequency and the occurrence of an input text file. I got the occurrence to but cant get the frequency. Formula for frequency is "Occurrence / total input count", this is the percentage of occurrence. Can someone please help me to get the frequency to work. Code: int freq[26] = {0}; fgets(input1, 10000, (FILE*)MyFile); for(i=0; i< strlen(input); i++) { freq[input[i]-'a']++; count++; } printf("Text count = %d", count); printf("\n"); printf("Frequency of plain text\n");...
For some reason I followed the steps in my project and I am getting the incorrect...
For some reason I followed the steps in my project and I am getting the incorrect output and when I am submitting it, it gives me compilation error. Printing empty array -- next line should be blank Testing append: Shouldn't crash! Should print 100 through 110 below, with 110 on a new line: 100 101 102 103 104 105 106 107 108 109 110 Checking capacity of new array: OK Append test #2: Should print 100 through 120 below, on...
JAVA please Arrays are a very powerful data structure with which you must become very familiar....
JAVA please Arrays are a very powerful data structure with which you must become very familiar. Arrays hold more than one object. The objects must be of the same type. If the array is an integer array then all the objects in the array must be integers. The object in the array is associated with an integer index which can be used to locate the object. The first object of the array has index 0. There are many problems where...
Can you please explain every question step by step. I am trying to understand it as...
Can you please explain every question step by step. I am trying to understand it as best as I can. Dr. Smith believes that exposing babies and children to classical music with raise their intelligence quotient (IQ). To test this idea, he administers IQ tests to 10 children of his friends who listen to classical music on a regular basis. He then compares the results from these 10 kids to the national average, which is 100. The results are below:...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT