how to make sure input is integer c
#include <string.h>
bool isNumber(string s)
{
for (int i = 0; i < strlen(s); i++)
if (isdigit(s[i]) == false)
return false;
return true;
}
how to make sure input is integer c
#include <string.h>
bool isNumber(string s)
{
for (int i = 0; i < strlen(s); i++)
if (isdigit(s[i]) == false)
return false;
return true;
}
c check if argument is integer
bool isNumber(char number[])
{
int i = 0;
//checking for negative numbers
if (number[0] == '-')
i = 1;
for (; number[i] != 0; i++)
{
//if (number[i] > '9' || number[i] < '0')
if (!isdigit(number[i]))
return false;
}
return true;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us