Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language input characters and numbers from the keyboard, such as "0.75", how to convert the corresponding 7 and 5 into plastic numbers?
C language input characters and numbers from the keyboard, such as "0.75", how to convert the corresponding 7 and 5 into plastic numbers?
This question is not very difficult. Let me give you an idea.

You can also reverse the order first and calculate from the back.

In the reverse order, use this function strrev.

From the back, use the cycle.

Find the position of the decimal point and calculate the number of decimal places. Is it easy to solve this problem by traveling with strings?

Calculate the value before decimal point and the value after decimal point,