0
How do i check if input is always an int?
I have a method
4 Respostas
+ 1
For C++
use header ctype.h and function isdigit(variable)
+ 1
you can convert to int with to_i method
a = gets.to_i
0
hey thanks guys sorry phone died.
I want to check if what the user gives me is text then give an error and if it's an integer then run it through an if statement
0
temp=gets.chomp
bool = temp .is_a ? integer
if bool
if temp < 20
do
else do