Code: Select all
#include <iostream>
using namespace std;
bool isNumber(char *c)
{
signed int len = strlen(c);
if(len > 0)
{
for(int i = 0;i<len;i++)
{
if(!(isxdigit(c[i])))
{
return false;
}
}
return true;
}
return false;
}
int main(void)
{
char *blah = "1";
if(isNumber(blah))
{
cout << "Yep" << endl;
}
else
{
cout << "Nope" << endl;
}
char * c;
c = "Hello World!";
cout << c << endl;
system("PAUSE");
return 0;
}