+ 4
Can anyone help me with a cpp program to input only int type?
The program should give error or text o/p that the input you gave is not an integer (if the input type is float,char,double etc)
13 Answers
+ 3
@kenyatta Great ! Your code does the job but for character inputs, I mean, I just tried using a float input and it gives me the integer o/p. Thanks anyways. The code was great !
+ 3
Yes, I did that only !
+ 2
Yes exactly, Some senior asked me during my classes and he left me in suspense; I wonder if thats possible or not. đ
(Everything is possible as, it is just a computer we can make it do almost anything).
+ 2
@Kenyatta I made a program myself that takes the input and saved it as
edit: string
then it uses loop to check if there is a decimal or not, if found returns false.
+ 2
@kenyatta I think this should work. As I don't know about this functions I an unable to understand and write proper code. Can yiu help me with a full program.(In your profile so I'd check it out). Thanks by the way.
+ 1
Hello, Navneet
You can see my codes
They all are of int type except the last one
That would help you
Please like if you find my codes good
+ 1
Thank You for your replies, but the solution I was expecting wasn't found.