i want to write a program that display data type of enterd value that enter by user.E.G. if user enter 2 then our program will display it is an integer value,if user enter 10.5 then our program will display it is an float value.user can enter only one value at a time.thanks
Detecting integer or float in user input
Collapse
X
-
Tags: None
-
prashantdwivedi , I was in 2 minds about deleting this thread and the only reason I have not is that you have written
we are not going to write your program for you but since you want to write it yourself you should go ahead and try, you can post back here with your attempt and the problems you are having.Originally posted by prashantdwivedii want to write a program ...
Simonius reply seems to be to be a fairly good summation of the situation, you are going to have to work out what characterises these different number formats and devise a way to detect those different characteristics .
A simple place to start might be what characterises a number as a float rather than an integer?Comment
Comment