Question

C++ Program: Prompt the user to enter a Fahrenheit degree then using the following formula to...

C++ Program:

Prompt the user to enter a Fahrenheit degree then using the following formula to convert it to Celsius degree. Don't accept any value less than -60 and more than 200.

C = (5/9)*(F – 32)

Homework Answers

Answer #1
#include <iostream>

using namespace std;

int main() {
    double f = -100, c;
    while (f < -60 || f > 200) {
        cout << "Enter temperature in fahrenheit(-60 to 200): ";
        cin >> f;
    }
    c = (f - 32) / 1.8;
    cout << f << " degrees fahrenheit is " << c << " degrees celsius" << 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
Convert values in fvalues array from degree Fahrenheit to degree Celsius and print it import numpy...
Convert values in fvalues array from degree Fahrenheit to degree Celsius and print it import numpy as np fvalues= np.array([[67, 65, 54, 35], [78, 89, 75, 73]]) To convert degree F to degree C - Deduct 32, then multiply by 5, then divide by 9
x86 irvine library assembly code Write a complete program that: 1. Prompt the user to enter...
x86 irvine library assembly code Write a complete program that: 1. Prompt the user to enter 10 numbers. 2. save those numbers in a 32-bit integer array. 3. Print the array with the same order it was entered. 3. Calculate the sum of the numbers and display it. 4. Calculate the mean of the array and display it. 5. Rotate the members in the array forward one position for 9 times. so the last rotation will display the array in...
Using MATLAB, prompt the user to enter a vector containing 3 elements that correspond to the...
Using MATLAB, prompt the user to enter a vector containing 3 elements that correspond to the scores a student received in three exams. Compute the average of the scores. If the average is less than 60, send a message to the command window telling the user that the student did not pass the course. Otherwise, send a message to the command window telling the user that the student has passed the course.
Using Python, write the following code. You are to allow the user to enter the daily...
Using Python, write the following code. You are to allow the user to enter the daily temperature as a floating-point number. You should make the assumption that you are recording temperatures in Fahrenheit. You should allow the user to continue entering temperatures until the value -999 is entered. This number should not be considered a temperature, but just a flag to stop the program. As the user enters a temperature, you should display the following each time: Current Temperature: 999...
Hi, I need a program in C, where it will prompt a user for a math...
Hi, I need a program in C, where it will prompt a user for a math quiz, either easy or medium. If the user choses difficulty easy, it will prompt the user for how many questions they would like from 1-5. If the user enters medium it will prompt the user on how many questions they would like from 1-10. After those prompts are entered questions will be displayed using rand(), the questions must be multiple choice or division, aswell...
Please use Python 3 4). Write a program that asks the user to enter 10 numbers....
Please use Python 3 4). Write a program that asks the user to enter 10 numbers. The program should store the numbers in a list and then display the following data: • The lowest number in the list • The highest number in the list •The total of the numbers in the list • The average of the numbers in the list   Sample input & output: (Prompt) Enter Number 1: (User enter) 4 (Prompt) Enter Number 2: (User enter) 7...
Write a Java program called Decision that includes a while loop to prompt the user to...
Write a Java program called Decision that includes a while loop to prompt the user to enter 5 marks using the JOptionPane statement and a System. Out statement to output a message inside the loop highlighting a pass mark >= 50 and <= 100. Any other mark will output a messaging stating it’s a fail. Example of the expected output is as follows:
Write a program in java that generates a two-column table showing Fahrenheit temperatures from -40F to...
Write a program in java that generates a two-column table showing Fahrenheit temperatures from -40F to 120F and their equivalent Celsius temperatures. Each line in the table should be 5 degrees F more than the previous one. Both the Fahrenheit and Celsius temperatures should be accurate to 1 decimal place. I am not able to use: import java.text.DecimalFormat; Any feedback would be helpful.
. Let F be an RV that represents the operating temperature in Fahrenheit of one instance...
. Let F be an RV that represents the operating temperature in Fahrenheit of one instance of a manufacturing process, and let F ∼ N(90, 5 2 ). Let C be an RV that represents the same process, but measured in Celsius. Fahrenheit can be converted to Celsius using C = 5 9 (F − 32). (I recommend doing these with a calculator and N(0, 1) table as practice for the exam. Then check your answers with R if you...
Write a program in C++ coding that asks the user to input an integer between 25...
Write a program in C++ coding that asks the user to input an integer between 25 and 50, inclusive. Utilize a WHILE loop to test for INVALID input. If the input is INVALID, the loop will repeat, and ask the user to try again. The pseudocode looks like this: Prompt user to input an integer between 25 and 50 Accept the input from the user Test for invalid input (HINT: use a while loop and the OR operator with 2...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT