Question: in C++ please. Write a C++ program that: (a) declares a variable X for storing a floating point number and initializes it with zero. (b)
in C++ please.Write a C++ program that: (a) declares a variable X for storing a floating point number and initializes it with zero. (b) asks the user to input a floating point number with 6 digits : 3 digits in whole number part and 3 digits in decimal part. (c) read user-input value and store it in X. (d) print digits in different positions of the X (hundreds, tens, ones, tenths, hundredths and thousandths) in the format shown in the sample output. Use tabs and newlines to mimic the format. (e) round user-input value stored in X and store the result it in X. (f) print out the rounded value. Sample Output Input a floating-point number with 6 digits (3 in whole number part and 3 in decimal part i.e. XXX.XXX) 456.789 The decimal part: thousandths: 9 hundredths: 8 tenths: 7 The whole number part: ones : 6 tens: 5 hundreds : 4 Rounded value : 457
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
