Im making a program that will convert centimeters(float) to feet(int) and inches(float)...here's the code;
the problem is how can i round the float numbers in one decimal places for example the user will input 3333 for the centimeters and the output will be like this....Code:#include <iostream> #include <conio.h> using namespace std; int main() { float cen, inch; int feet; cout << "input centimeter to be converted to feet and inches: " << endl; cin>> cen; cout << cen << " is " << (feet=0.03280839895*cen) << " feet and " << (inch=0.3937007874*cen) << " inches\n"; getch(); }
333.3 is 10 feet and 131.2 inches
i don't know how to do it if the user input 3333 the program will read it as 333.3 and will convert it to feet and inches.... I know how to do it using C code but in C++ dont know how....anyone there any ideas... really need help