Link Exchange
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
โจทย์ นำมาจาก http://pantip.com/topic/33002353บล็อกไม่ให้พิมตัวเลข
/* @Author: Mr.Suppakit Thongdee @Website: www.sourcecode.in.th */ #include <stdio.h> #include <conio.h> void main(){ char ch; char strInput[255]; int iCh; int i; clrscr(); printf("Please type input: "); i = 0; do{ ch = getch(); iCh = (int)ch; //'0' = 48, '9' = 57 if( (iCh<48 || iCh>57) && iCh!=8 ){ printf("%c",ch); strInput[i] = ch; i = i+1; } }while(ch!=13); //Remove ENTER key i = i-1; strInput[i] = '\0'; printf("\nYour input: %s", strInput); getch(); }
Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us