Question

In: Computer Science

Using C++ code, write a program to convert a distance d given in inches (in) to...

Using C++ code, write a program to convert a distance d given in inches (in) to centimeters (cm), where d is input by a user via the keyboard and 1in = 2.54cm. Your submission should include screenshots of the execution of the program using the values 1.5, 4 and 6.75.

Solutions

Expert Solution

#include<iostream>

using namespace std;

int main(){

  double inches;

  double cm;

  //reading distance in inches

  cout<<"Enter distance in inches: ";

  cin>>inches;

  //converting inches into cm

  cm=inches *2.54;

  //printing distance in cm

  cout<<"Distance in cm : "<<cm;

  

}

Note : If you like my answer please rate and help me it is very Imp for me


Related Solutions

Write a C program to calculate the number of fence panels needed over a given distance....
Write a C program to calculate the number of fence panels needed over a given distance. The fence must be created using two difference size panels which have a 2 foot length difference between them (ie. panels could be 2’ and 4’ or 3’ and 5’ or 5’and 7’). Your program should request the total length of the fence and the smaller panel's size. Your program will then calculate the length of the larger panel and output the number of...
Write a code for simple racing game (using dots) on c program.
Write a code for simple racing game (using dots) on c program.
Please answer using MSP design and program for C. Write CCS code. outline the program for...
Please answer using MSP design and program for C. Write CCS code. outline the program for MSP design, and program for C. Make a project that uses one timer on the board to control the blinking of the LED. Basically setup a timer interupt. Whenever the timer interrupt happens, the LED blinks. The frequency of the blinking is chosen by the user. Next modify the program above and make a project that uses one of the pushbuttons on the board...
write a assembly language program to convert GRAY to BCD code in 8051
write a assembly language program to convert GRAY to BCD code in 8051
Write a C++ program using produces Huffman code for a string of text entered by the...
Write a C++ program using produces Huffman code for a string of text entered by the user. Must accept all ASCII characters.
C++ Code You will write a program to process the lines in a text file using...
C++ Code You will write a program to process the lines in a text file using a linked list and shared pointers. You will create a class “Node” with the following private data attributes: • Line – line from a file (string) • Next (shared pointer to a Node) Put your class definition in a header file and the implementation of the methods in a .cpp file. The header file will be included in your project. If you follow the...
Write a C++ program using produces Huffman code for a string of text entered by the...
Write a C++ program using produces Huffman code for a string of text entered by the user. The string given by the user can be either 1 word or 1000 words. Must accept all ASCII characters. Please do not copy from the internet. This is my 3rd time posting the same question and I have not received a correct answer.
Please answer QC,D,E,F using the code provided at the end please. A. Write C code to...
Please answer QC,D,E,F using the code provided at the end please. A. Write C code to define a structure called date that has three fields day, month, year, all of which are ints. B. Write C code to define a structure called person that has fields for name (50 char array), dateOfBirth (date struct from Q1), address (200 char array), phoneNum (20 char array), and ID (int). C. Write a C program that uses the person structure from Q2, and...
Using Python Write a GUI program that converts a distance in Meters to the equivalent distance...
Using Python Write a GUI program that converts a distance in Meters to the equivalent distance in Feet. The user should be able to enter a distance in Meters, click a button, and then see the equivalent distance in feet. Use the following formula to make the conversion: Meters = Feet x 0.304 For example, 1 Meter is 3.28 Feet.
Write code for a simple snake game (using dots) on C program. Using openframeworks. it should...
Write code for a simple snake game (using dots) on C program. Using openframeworks. it should be simple because I am new to coding and I cant write complicated code. just make it simple.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT