Write a program that takes length as input in feet and inches. The program should then convert the lengths in centimeters and display it on screen. Assume that the given lengths in feet and inches are integers. This should be a c++ program. Just share the code and a screenshot of the output.
Answers
Answer:
You are not passing values into your functions. You have the functions, but they neither take a value as input nor return a value as output. It should be extremely easy to find material on how to input and return values from functions in C++, so I will spare my time. Just make it so your 'conversion()' function takes the values in feet and inches as input. It might be a little "trickier" for someone new to C++ to return multiple values in a single function, so you might just want to simplify your life and make two separate functions, one that takes feet and returns meters, one that takes inches and returns centimeters. If you know how to do it in a single one, it's very simple. But if not, my suggestion might help.
EDIT: I did not see that your function variables are Global (not used to it). If you are new to programming and are interested, it is generally a bad idea to have anything be a global variable unless you specifically have reasons for doing so (i.e. declaring a global constant 'pi'). Yes, since they are global, all you need to do is call your conversion function I believe