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...
Use Python: the formula for converting a temperature from Fahrenheit to Celcius is C=5/9(f-32) where F...
Use Python: the formula for converting a temperature from Fahrenheit to Celcius is C=5/9(f-32) where F is the Fahrenheit temperatre and C is the celcius temperature. Write a function named celcius that accepts a Fahrenheit temperature as an argument. the function should return the temperature, convertedm to celcius. Demonstrate the function by calling it in a loop that displays a table of the fahrenheit temperatures 0 through 20 and their Celsius equivalents.
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...
Create a program that the simulates a thermometer and displays its temperature using different units. 1-...
Create a program that the simulates a thermometer and displays its temperature using different units. 1- Temperature Interface (Temperature.java) This interface should declare the following two abstract methods: • getTemperature      o Returns a String o Accepts no arguments • setTemperature      o Returns void o Accepts one double argument 2- Abstract Thermometer Class (Thermometer.java) This abstract class must implement the Temperature interface and contain: • One private field (a double) named degrees • One constructor that accepts a double...
#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++ program***** Please implement the following, comments throughout code to explain, and provide screenshots of output...
*****C++ program***** Please implement the following, comments throughout code to explain, and provide screenshots of output for proof. Write a program for sorting a list of integers in ascending order using the bubble sort algorithm. Implement the following functions: Implement a function called readData int readData( int *arr) arr is a pointer for storing the integers. The function returns the number of integers. The function readData reads the list of integers from a file call data.txt into the array arr....
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");...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT