|
From: Exuss D. <dra...@ce...> - 2001-12-22 07:10:20
|
Hi, All! :)
How to check input data type from the console? For example, I need
only number, and how to check that some letters wasn't entered?
This code shows doesn't work for me, if I try to enter some number,
it shows a zero in every condition. ://
#include <stdlib.h>
#include <ctype.h>
#include <iostream.h>
void main()
{
int number;
cout << "\n\tInput number or letter: ";
cin >> number;
cout << "\n\tIs alnum?: " << isalnum(number) << endl;
cout << "\tIs digit?: " << isdigit(number) << endl;
cout << "\tIs alpha?: " << isalpha(number) << endl;
cout << "\tIs lower?: " << islower(number) << endl;
cout << endl;
system("PAUSE");
}
Are there other way to check what was entered from console, digital
number or text ???
Thanx,
Exuss :)
--
Nemokama el.pašto dėžutė - http://webmail.delfi.lt/
|