//数字范围可超过200位
//只接受数字和ENTER键
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
int ASCII;
int Count = 0;
char *a = (char *) malloc ((Count + 1) * sizeof(char));
printf("请输入数字:");
while ( !_kbhit() ) {
ASCII = _getch();
if ( ASCII == 0xD )
break;
else {
if ( ASCII >= 48 && ASCII <= 57 ) {
printf("%c", ASCII);
a = (char *) realloc (a, (Count + 1) * sizeof(char));
a[Count] = (char) ASCII;
Count++;
if (Count == 1 && ASCII == 48)
break;
}
}
}
printf("\n有%d个数字为: ", Count);
while (Count