Hey guys!
My instructor gave us an assignment to Write a C++ program to convert a distance given in feet and inches to meters. The problem is that he hasn't showed us how to do this using feet and inches. Ive been looking for tutorials to teach me how to write this program but I've come up empty. Does anyone know how to write this and does anyone have any c++ sites they recommend for beginners? Thanks n advance for any and all help guys!
He wants us to use these conversions for the problem.
Conversion ratios: one foot is 12 inches, one inch is 2.54 centimeters and one meter is 100 centimeters.
This is what I attempted in visual studio code.
//
// conv.cpp
// Apple Honey
// Jun. 22,2020
//
// CSCI-14 unit conversion program
// convert a distance given in feet and inches to meters
// one foot is 12 inches, one inch is 2.54 centmeters,
// and one meter is 100 centimeters.
//
#include<iostream.h>
#inclue <iomanip>
using namespace std;
int main()
{
const float CENTIMETERSPERINCH = 2.54;
cont int INCHESPERFOOT = 12;
const int CENTIMETERSPERMETER = 100;
int feet = 0;
int inches = 0;
my program will prompt for feet (a whole number only) and inches (allow a fractional part). It
will then convert the distance to meters and display the user’s entries and the result with
reasonable descriptive text. For example, a test run could look like this:
Enter feet : 0
Enter inches : 39.3701
0 feet and 39.3701 inches is 1 meters.
l know how to write a program for feet and inches to cm so ill try that step first :)
Went out of my way to over complicate things BUT i did post the shorter code afterwards. Just wanted to show that you can approach problems from multiple angles. I over complicate things all the time, it's a habit. I just love using loops.