Question

Create a program that displays a measurement in ei
Can someone help me with a c++ program
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the code for you:

#include <iostream>
using namespace std;
double centimetersToInches(double centimeters)
{
return 0.393701 * centimeters;
}
double inchesToCentimeters(double inches)
{
return 2.54 * inches;
}
int main()
{
int choice;
double centimeters, inches;
cout<<"1. Centimeters to Inches."<<endl;
cout<<"2. Inches to Centimeters."<<endl;
cout<<"Enter your choice: ";
cin>>choice;
if(choice == 1)
{
cout<<"Enter the centimeters: ";
cin>>centimeters;
cout<<centimeters<<" cms = "<<centimetersToInches(centimeters)<<" inches."<<endl;
}
else if(choice == 2)
{
cout<<"Enter the inches: ";
cin>>inches;
cout<<inches<<" inches = "<<inchesToCentimeters(inches)<<" cms."<<endl;
}
}

And the output screenshot is:

Add a comment
Know the answer?
Add Answer to:
Can someone help me with a c++ program Create a program that displays a measurement in...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ The manager of Keystone Tile wants an application that displays the area of a rectangular...

    C++ The manager of Keystone Tile wants an application that displays the area of a rectangular floor, given its measurements in feet. It should also display the total cost of tiling the floor, given the price per square foot of tile. 1-Create a new project named Intermediate13 Project, and save it in the Cpp8\Chap04 folder. Enter your C++ instructions into a source file named Intermediate13.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Test the program...

  • chapter 7. Create a program that allows the user to enter the ages (in years) of...

    chapter 7. Create a program that allows the user to enter the ages (in years) of five people. The program should display the average age. Use the for the statement. Display the average age with one decimal place. If necessary, create a new project named TryThis15 Project, and save it in the Cpp8\Chap07 folder. Enter the C++ instructions into a source file named TryThis15.cpp. Also, enter appropriate comments and any additional instructions required by the compiler. Test the program using...

  • What am I doing wrong here...…. Question is this : In this exercise, you will create...

    What am I doing wrong here...…. Question is this : In this exercise, you will create a program that displays a table consisting of four rows and three columns. The first column should contain the numbers 10 through 13. The second and third columns should contain the results of squaring and cubing, respec- tively, the numbers 10 through 13. The table will look similar to the one shown in Figure 9-38. If necessary, create a new project named Introductoryl6 Project,...

  • An online retailer wants a program that displays the total amount a customer owes, including shipping....

    An online retailer wants a program that displays the total amount a customer owes, including shipping. The user will enter the total amount due before shipping. The amount to charge for shipping is based on the customer's membership status, which can be either Standard or Premium. The appropriate shipping charges are shown in Figure 9-42. The program should use two program-defined functions: one to determine the shipping charge for a Standard member and the other to determine the shipping charge...

  • In this exercise, you will modify the hypotenuse program shown earlier in Figure 9-6. Follow the...

    In this exercise, you will modify the hypotenuse program shown earlier in Figure 9-6. Follow the instructions for starting C++ and viewing the ModifyThis13.cpp file, which is contained in either the Cpp8/Chap09/ModifyThis13 Project folder or the Cpp8/Chap09 folder. Remove both calculation tasks from the main function, and assign both to a program-defined value-returning function named getHypotenuse. Test the program appropriately. //Hypotenuse.cpp - displays the length of a right //triangle's hypotenuse #include <iostream> #include <iomanip> #include <cmath> using namespace std; int...

  • 25. In this exercise, you create a program for the sales manager at Computer Haven, a...

    25. In this exercise, you create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local companies. Figure 7-53 shows the charge for attending a seminar. Notice that the charge per person depends on the number of people the company registers. For example, the cost for four registrants is $400; the cost for two registrants is $300. The program should allow the sales manager to enter the number of registrants for as...

  • Mountain Coffee wants a program that allows a clerk to enter the number of pounds of...

    Mountain Coffee wants a program that allows a clerk to enter the number of pounds of coffee ordered, the price per pound, and whether the customer should be charged a 3.5% sales tax. The program should calculate and display the total amount the customer owes. Use an int variable for the number of pounds, a double variable for the price per pound, and a char variable for the sales tax information. a. Create an IPO chart for the problem, and...

  • INSTRUCTIONS #6. Your science teacher has asked you to create an application that displays how much...

    INSTRUCTIONS #6. Your science teacher has asked you to create an application that displays how much a person would weigh on the following planets: Venus, Mars, and Jupiter. The application's interface should allow the user to enter the person's weight on Earth. Perform the steps involved in creating an OO application. (See the Note at the beginning of the Exercises section.) Include a button for clearing the screen. . Create an application, using the following names for the solution and...

  • I have this c++ program that i have to create but i am stuck on it....

    I have this c++ program that i have to create but i am stuck on it. Write a height conversion program that shall allow user to convert from feet and inches to meters (option 1) and vice versa (option 2). User shall be able to specify the type of conversion (a menu of two options). Display an error message if an invalid option is specified. Otherwise, the program would read in a length in feet and inches (two separate integer...

  • If necessary, create a new project named Intermediate24 Project and save it in the Cpp8\Chap14 folder....

    If necessary, create a new project named Intermediate24 Project and save it in the Cpp8\Chap14 folder. Also create a new source file named Intermediate24.cpp. If you are using Microsoft Visual C++, copy the Intermediate24.txt file from the Cpp8\Chap14 folder to the Cpp8\Chap14\Intermediate24 Project folder. Use a text editor to open the Intermediate24.txt file, which contains payroll codes and salaries. Close the Intermediate24.txt file. Create a program that allows the user to enter a payroll code. The program should search for...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT