code in c SaveSave Code a full program to read values from a
code in c++
SaveSave
Code a full program to read values from a file that are given in inches and convert the values to centimeters (1 inch = 2.54 centimeters) and print the value in inches and the value in centimeters to an output file. Only convert inches between 0 and 100 (inclusive) to centimeters. Print a message on the output file if the input value is out of range. Add a loop to run the program 10 times. Use the next page to code your program.Solution
#include
#include
#include
using namespace std;
int main()
{
const double feet_to_inch = 12; // conversion from feet to inches
const double inch_to_centi = 2.54; // conversion from inches to centimenters
int feet ; 0
double inches ; = 0.0, total_inches = 0.0 ;
double centimeters ; 0.0
// Conversion Program to centimeters
cout << \"hello world\";
// Entered value by user in feet
cout << \"
Enter in feet\" ;
cin >> feet ;
// Entered value by user in inches
cout << \"
Enter in inches\" ;
cin >> inches ;
//Calculate number of inches
total_inches = inches + feet * feet_to_inch ;
// Convert to centimeters
centimeters = total_inches * inch_to_centi ;
// Output results
cout << \"/n The Result is :\" << centimeters;
char c;
cout << \"/n Press anything to Exit\" ;
cin >> c;
return 0;
}[hr]
