|
แจก Source จ้า แจก Source ฟรี!!
โพสต์เมื่อ:
11:31 วันที่ 22 มี.ค. 2549 ชมแล้ว:
4,484
ตอบแล้ว:
110
แจก sorce code C++ ฟรีไม่มีอั้น ลองอ่านกันนะ
ความเห็นเพิ่มเติมที่ 1 22 มี.ค. 2549 (11:43) source ที่ท่านจะได้อ่านต่อไปนี้เป็นผลงานการเขียนของ อาจารย์นคร สาแก้ว ซึ่งได้นำมาแก้ไขปรับปรุงใหม่ ให้เข้ากับโปรเจ็คส์ แต่ปรากฎว่า ไม่สามารถใส่เป็นฟังก์ชั่นในโปรเจ็คส์ได้ จึงขออนุญาตินำ source ที่แก้ไขนี้มาให้ดูค่ะ หากใครมาความสามารถแก้ไขจนสำเร็จได้ ขอความกรุณาเผยแพร่ต่อ และกรุณานำชื่อต้นฉบับ คืออาจารย์ นคร สาแก้ว เพราะนอกจากจะเป็นการให้เกียรติอาจารย์แล้ว ยังเป็นมารยาทที่ดีอีกด้วยค่ะ ความเห็นเพิ่มเติมที่ 2 22 มี.ค. 2549 (11:44) เริ่มต้นจากฟังก์ชั่น chcksize ค่ะ void ch_size(int i , char * str); { int len; for(len = 0;len < i - 1;len++) { *(str+len) = getche(); if((str + len) == ESCK) { display_mainmenu(); } if((str + len) == ENTERK) { len++; break; } else if(*(str + len) == SP); else if((*(str + len) == BKSPK) && (*(str + len) != ':')) { do { putch(' '); printf("/b"); len--; *(str+len) = getche(); }while((*(str + len) == BKSPK) && !(len <= 0)); } } *(str+(len)) = 0; } ความเห็นเพิ่มเติมที่ 3 22 มี.ค. 2549 (11:45) ขอโทษด้วยหากท่านไม่เข้าใจ เนื่องจากเวลาลงบนอินเทอร์เนต การใช้ tab จะไม่ได้ผลค่ะ ความเห็นเพิ่มเติมที่ 4 22 มี.ค. 2549 (11:46) ต่อไปเป็น chckaddr ค่ะ #include<stdio.h> #include<conio.h> #define ESCK 0x1b #define ENTERK 0x0d #define BKSPK 0x08 //desccription of function //1. get character for address //2. can user key backspace //3. if user key enter then return value and goto main function (end of function) //4. function declare about put code for main program only //5. end of funtion with ESC Code or get enter //6. use / or character and nummeric only //declare function in CheckCod.c void Myputch(char); void fillch(unsigned char,unsigned char,char ,unsigned char,unsigned char ,unsigned char ); unsign char GetNum(unsigned char,unsigned char,char*,unsigned char,unsigned char*,unsigned char*); //------------------------------------This is fuction main--------------------------------------------- char chckaddr() { // declare varible for function char str[50+1]="" //string 10 and first declare = NULL unsigned char ascii =0x0 //store ascii code in every code declare = 0(in hexemal) unsigned char s_code =0x0 //store Address for code in keyboard declare = 0(in hexemal) // process main of funtion printf("born : ") Getnum(wherex(),wherey(),str,sizeof(str),&ascii,&s_code) if (ascii = ENTERK) strcpy(str,address) return(char)(address) } ความเห็นเพิ่มเติมที่ 5 22 มี.ค. 2549 (11:46) //----------------------------------this is another function------------------------------------------- //++++++++++++++++++++++++++++++++++++++++Funtion GetNum+++++++++++++++++++++++++++++++++++++++++++++++ //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+function description of GetNum+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- //Description : getting only set of alphanumerric. //parameter : x,y = (position) // *str = address of string (use pointer) // len = size of str (use fuction sizeof(str)) //returning : posit = how many leght of string // *ascii = value of ascii (use pointer) // *s_code = value of san code (use pointer) seek for address of key on keyboard //+-+-+-+-+-+-+-+-+-+-+-+-+-+End function description of GetNum+-+-+-+-+-+-+ ความเห็นเพิ่มเติมที่ 6 22 มี.ค. 2549 (11:47) //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+process of GetNum-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ unsigned char GetNum(unsigned char x,unsigned char y,char *str,unsigned char len,unsigned char*ascii,unsigned char *s_code) { unsigned char posit = 0x0; Fillch(x,y,'_',(len-1),14,9) //call function Fillch gotoxy(x,y); do { *ascii = Mykey((unsigned char*)_scode); //call function Mykey if(ascii == ESCK) break; // if user key ESC Code then break else if (*ascii == BKSPK) { if (posit>0) { textcolor(14); textbackground(4); *(str+(--posit)) = 0x0; putch('\b'); //backspace Myputch('_') //call Myputch fuction putch('\b'); //backspace } continue; } //check key about nummeric key if (((*ascii >= '0')&&(*ascii <= '9')) || (*ascii <= '/') ||((*ascii >= 'A')&&(*ascii <= 'Z')) || ((*ascii >= 'a')&&(*ascii <= 'z'))) { *(str + posit) = (char) *ascii; *(str + (++posit)) = (char) 0x0; Myputch(*ascii); //call Myputch fuction } else putch(7); //one sound beep }while (posit<(len-1)) if(posit == (len-1)) *ascii = (unsigned char)ENTERK; // set acception for key value if(posit < (len - 1)) { gotoxy(x,y); printf("%s",str); } return (unsigned char) (posit); } //++++++++++++++++++++++++++++++++++++++End Funtion GetNum+++++++++++++++++++++++++++++++++++++++++++++ ความเห็นเพิ่มเติมที่ 7 22 มี.ค. 2549 (11:48) //++++++++++++++++++++++++++++++++++++++++Funtion Fillch+++++++++++++++++++++++++++++++++++++++++++++++ void fillch(unsigned char x,unsigned char y,char ch,unsigned char len,unsigned char f_color,unsigned char Bg_color) { //declare variable unsigned int far* attr = (unsigned int far*) 0xb8000000; unsigned value = ((unsigned)(((unsigned char)bg_color << 4) &0xf0) | ((unsigned char) f_color & 0x0f)) << 8) | ((unsigned)ch & 0x00ff)); unsigned posit = ((--y * 80) + (--x)) ; unsigned lenght = 0; //process of function *(mem_ch (((y - 1) * 160 + (x - 1)* 2))) = (char)ch; gotoxy((x = ((++x)>80)? 80 : x), y) //ternary expression } //++++++++++++++++++++++++++++++++++++++End Funtion Fillch+++++++++++++++++++++++++++++++++++++++++++++ สิ้นสุดฟังก์ชั่น chckaddr ค่ะ ความเห็นเพิ่มเติมที่ 8 22 มี.ค. 2549 (11:48) ต่อไปเป็นฟังก์ชั่น chckborn ค่ะ #include<stdio.h> #include<conio.h> #define ESCK 0x1b #define ENTERK 0x0d #define BKSPK 0x08 //desccription of function //1. get character for born or date //2. can user key backspace //3. if user key 5 character then return value and goto main function (end of function) //4. function declare about put code for main program only //5. end of funtion with ESC Code or get charater with ten character //6. use / or nummeric only //declare function in CheckCod.c void Myputch(char); void Autofill(char*,unsigned char); void fillch(unsigned char,unsigned char,char ,unsigned char,unsigned char ,unsigned char ); unsign char GetNum(unsigned char,unsigned char,char*,unsigned char,unsigned char*,unsigned char*); //------------------------------------This is fuction main--------------------------------------------- char chckborn(); { // declare varible for function char str[10+1]="" //string 10 and first declare = NULL unsigned char ascii =0x0 //store ascii code in every code declare = 0(in hexemal) unsigned char s_code =0x0 //store Address for code in keyboard declare = 0(in hexemal) // process main of funtion printf("born : ") Getnum(wherex(),wherey(),str,sizeof(str),&ascii,&s_code) strcpy(str,born); return(char)(born); } ความเห็นเพิ่มเติมที่ 9 22 มี.ค. 2549 (11:49) //----------------------------------this is another function------------------------------------------- //++++++++++++++++++++++++++++++++++++++++Funtion GetNum+++++++++++++++++++++++++++++++++++++++++++++++ //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+function description of GetNum+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- //Description : getting only set of alphanumerric. //parameter : x,y = (position) // *str = address of string (use pointer) // len = size of str (use fuction sizeof(str)) //returning : posit = how many leght of string // *ascii = value of ascii (use pointer) // *s_code = value of san code (use pointer) seek for address of key on keyboard //+-+-+-+-+-+-+-+-+-+-+-+-+-+End function description of GetNum+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ความเห็นเพิ่มเติมที่ 10 22 มี.ค. 2549 (11:50) //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+process of GetNum-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ unsigned char GetNum(unsigned char x,unsigned char y,char *str,unsigned char len,unsigned char*ascii,unsigned char *s_code) { unsigned char posit = 0x0; Fillch(x,y,'_',(len-1),14,9) //call function Fillch gotoxy(x,y); do { *ascii = Mykey((unsigned char*)_scode); //call function Mykey if(ascii == ESCK) break; // if user key ESC Code then break else if (*ascii == BKSPK) { if (posit>0) { textcolor(14); textbackground(4); *(str+(--posit)) = 0x0; putch('\b'); //backspace Myputch('_') //call Myputch fuction putch('\b'); //backspace } continue; } //check key about nummeric key if (((*ascii >= '0')&&(*ascii <= '9')) || (*ascii <= '/')) { *(str + posit) = (char) *ascii; *(str + (++posit)) = (char) 0x0; Myputch(*ascii); //call Myputch fuction } else putch(7); //one sound beep }while (posit<(len-1)) if(posit == (len-1)) *ascii = (unsigned char)ENTERK; // set acception for key value if(posit < (len - 1)) { AutoFill(str,len); gotoxy(x,y); printf("%s",str); } return (unsigned char) (posit); } //++++++++++++++++++++++++++++++++++++++End Funtion GetNum+++++++++++++++++++++++++++++++++++++++++++++ ความเห็นเพิ่มเติมที่ 11 22 มี.ค. 2549 (11:51) //++++++++++++++++++++++++++++++++++++++++Funtion Fillch+++++++++++++++++++++++++++++++++++++++++++++++ void fillch(unsigned char x,unsigned char y,char ch,unsigned char len,unsigned char f_color,unsigned char Bg_color) { //declare variable unsigned int far* attr = (unsigned int far*) 0xb8000000; unsigned value = ((unsigned)(((unsigned char)bg_color << 4) &0xf0) | ((unsigned char) f_color & 0x0f)) << 8) | ((unsigned)ch & 0x00ff)); unsigned posit = ((--y * 80) + (--x)) ; unsigned lenght = 0; //process of function *(mem_ch (((y - 1) * 160 + (x - 1)* 2))) = (char)ch; gotoxy((x = ((++x)>80)? 80 : x), y) //ternary expression } //++++++++++++++++++++++++++++++++++++++End Funtion Fillch+++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++Funtion AutoFill++++++++++++++++++++++++++++++++++++++++++++++ void Autofill(char * str,unsigned char len) { //declare variable char tmp_buff[15] = ""; unsigned char size = (len - abs (str - strchar (str,0))); //process of function for(;posit < (size - 1);posit++) tmp_buff[posit] = (char) '0'; tmp_buff[posit]=0x0; strcat(tmp_buff,str); strcpy(str,tmp_buff); } //+++++++++++++++++++++++++++++++++++++End Funtion AutoFill++++++++++++++++++++++++++++++++++++++++++++ สิ้นสุดฟังก์ชั่น chckborn ค่ะ ความเห็นเพิ่มเติมที่ 12 22 มี.ค. 2549 (11:53) ต่อไปเป็นฟังก์ชั่น chckdate #include<stdio.h> #include<conio.h> #define ESCK 0x1b #define ENTERK 0x0d #define BKSPK 0x08 //desccription of function //1. get character for present date //2. can user key backspace //3. if user key 5 character then return value and goto main function (end of function) //4. function declare about put code for main program only //5. end of funtion with ESC Code or get charater with ten character //6. use / or nummeric only //declare function in CheckCod.c void Myputch(char); void Autofill(char*,unsigned char); void fillch(unsigned char,unsigned char,char ,unsigned char,unsigned char ,unsigned char ); unsign char GetNum(unsigned char,unsigned char,char*,unsigned char,unsigned char*,unsigned char*); ความเห็นเพิ่มเติมที่ 13 22 มี.ค. 2549 (11:54) //------------------------------------This is fuction main--------------------------------------------- char chckdate(); { // declare varible for function char str[10+1]="" //string 10 and first declare = NULL unsigned char ascii =0x0 //store ascii code in every code declare = 0(in hexemal) unsigned char s_code =0x0 //store Address for code in keyboard declare = 0(in hexemal) // process main of funtion printf("present date : "); Getnum(wherex(),wherey(),str,sizeof(str),&ascii,&s_code); strcpy(str,present_date); return(char)(present_date); } ความเห็นเพิ่มเติมที่ 14 22 มี.ค. 2549 (12:00) //----------------------------------this is another function------------------------------------------- //++++++++++++++++++++++++++++++++++++++++Funtion GetNum+++++++++++++++++++++++++++++++++++++++++++++++ //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+function description of GetNum+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- //Description : getting only set of alphanumerric. //parameter : x,y = (position) // *str = address of string (use pointer) // len = size of str (use fuction sizeof(str)) //returning : posit = how many leght of string // *ascii = value of ascii (use pointer) // *s_code = value of san code (use pointer) seek for address of key on keyboard //+-+-+-+-+-+-+-+-+-+-+-+-+-+End function description of GetNum+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ความเห็นเพิ่มเติมที่ 15 22 มี.ค. 2549 (12:02) //++++++++++++++++++++++++++++++++++++++++Funtion Fillch+++++++++++++++++++++++++++++++++++++++++++++++ void fillch(unsigned char x,unsigned char y,char ch,unsigned char len,unsigned char f_color,unsigned char Bg_color) { //declare variable unsigned int far* attr = (unsigned int far*) 0xb8000000; unsigned value = ((unsigned)(((unsigned char)bg_color << 4) &0xf0) | ((unsigned char) f_color & 0x0f)) << 8) | ((unsigned)ch & 0x00ff)); unsigned posit = ((--y * 80) + (--x)) ; unsigned lenght = 0; //process of function *(mem_ch (((y - 1) * 160 + (x - 1)* 2))) = (char)ch; gotoxy((x = ((++x)>80)? 80 : x), y) //ternary expression } //++++++++++++++++++++++++++++++++++++++End Funtion Fillch+++++++++++++++++++++++++++++++++++++++++++++ ความเห็นเพิ่มเติมที่ 16 22 มี.ค. 2549 (12:04) //+++++++++++++++++++++++++++++++++++++++Funtion AutoFill++++++++++++++++++++++++++++++++++++++++++++++ void Autofill(char * str,unsigned char len) { //declare variable char tmp_buff[15] = ""; unsigned char size = (len - abs (str - strchar (str,0))); //process of function for(;posit < (size - 1);posit++) tmp_buff[posit] = (char) '0'; tmp_buff[posit]=0x0; strcat(tmp_buff,str); strcpy(str,tmp_buff); } //+++++++++++++++++++++++++++++++++++++End Funtion AutoFill++++++++++++++++++++++++++++++++++++++++++++ สิ้นสุดฟังก์ชั่น chckdate ความเห็นเพิ่มเติมที่ 17 22 มี.ค. 2549 (12:06) ต่อไปเป็นฟังก์ชั่น chckp_id #include<stdio.h> #include<conio.h> #define ESCK 0x1b #define ENTERK 0x0d #define BKSPK 0x08 //desccription of function //1. get any nummeric only with 13 character about product //2. can user key backspace //3. if user key 5 character then return value and goto main function (end of function) //4. function declare about put code for main program only //5. end of funtion with ESC Code or get nummeric with five character //declare function in CheckCod.c char Mykey(unsigned char*); void Myputch(char); void Autofill(char*,unsigned char); void fillch(unsigned char,unsigned char,char ,unsigned char,unsigned char ,unsigned char ); unsign char GetNum(unsigned char,unsigned char,char*,unsigned char,unsigned char*,unsigned char*); //------------------------------------This is fuction main--------------------------------------------- char chckp_id() { // declare varible for function char str[13+1]="" //string 13 and first declare = NULL unsigned char ascii =0x0 //store ascii code in every code declare = 0(in hexemal) unsigned char s_code =0x0 //store Address for code in keyboard declare = 0(in hexemal) // process main of funtion printf("(1.) product id : ") Getnum(wherex(),wherey(),str,sizeof(str),&ascii,&s_code) strcmp(str,product_id) return(char)(product_id) } //----------------------------------this is another function------------------------------------------- ความเห็นเพิ่มเติมที่ 18 22 มี.ค. 2549 (12:06) //----------------------------------this is another function------------------------------------------- //++++++++++++++++++++++++++++++++++++++++Funtion Mykey++++++++++++++++++++++++++++++++++++++++++++++++ char mykey(unsigned char *s_code) { char ch = 0x0; if((ch = getch())==0) // if user key 0 { *s_code = (unsigned char)getch(); ch = 0; } return(char),(ch); } //+++++++++++++++++++++++++++++++++++++End Function Mykey++++++++++++++++++++++++++++++++++++++++++++++ //++++++++++++++++++++++++++++++++++++++++Funtion GetNum+++++++++++++++++++++++++++++++++++++++++++++++ //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+function description of GetNum+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- //Description : getting only set of alphanumerric. //parameter : x,y = (position) // *str = address of string (use pointer) // len = size of str (use fuction sizeof(str)) //returning : posit = how many leght of string // *ascii = value of ascii (use pointer) // *s_code = value of san code (use pointer) seek for address of key on keyboard //+-+-+-+-+-+-+-+-+-+-+-+-+-+End function description of GetNum+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ความเห็นเพิ่มเติมที่ 19 22 มี.ค. 2549 (12:07) //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+process of GetNum-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ unsigned char GetNum(unsigned char x,unsigned char y,char *str,unsigned char len,unsigned char*ascii,unsigned char *s_code) { unsigned char posit = 0x0; Fillch(x,y,'_',(len-1),14,4) //call function Fillch gotoxy(x,y); do { *ascii = Mykey((unsigned char*)_scode); //call function Mykey if(ascii == ESCK) break; // if user key ESC Code then break else if (*ascii == BKSPK) { if (posit>0) { textcolor(14); textbackground(4); *(str+(--posit)) = 0x0; putch('\b'); //backspace Myputch('_') //call Myputch fuction putch('\b'); //backspace } continue; } //check key about nummeric key if ((*ascii >= '0')&&(*ascii <= '9')) { *(str + posit) = (char) *ascii; *(str + (++posit)) = (char) 0x0; Myputch(*ascii); //call Myputch fuction } else putch(7); //one sound beep }while (posit<(len-1)) if(posit == (len-1)) *ascii = (unsigned char)ENTERK; // set acception for key value if((posit < (len - 1)) && (*ascii == ENTERK)) { AutoFill(str,len); gotoxy(x,y); printf("%s",str); } return (unsigned char) (posit); } //++++++++++++++++++++++++++++++++++++++End Funtion GetNum+++++++++++++++++++++++++++++++++++++++++++++ ความเห็นเพิ่มเติมที่ 20 22 มี.ค. 2549 (12:08) //++++++++++++++++++++++++++++++++++++++++Funtion Fillch+++++++++++++++++++++++++++++++++++++++++++++++ void fillch(unsigned char x,unsigned char y,char ch,unsigned char len,unsigned char f_color,unsigned char Bg_color) { //declare variable unsigned int far* attr = (unsigned int far*) 0xb8000000; unsigned value = ((unsigned)(((unsigned char)bg_color << 4) &0xf0) | ((unsigned char) f_color & 0x0f)) << 8) | ((unsigned)ch & 0x00ff)); unsigned posit = ((--y * 80) + (--x)) ; unsigned lenght = 0; //process of function *(mem_ch (((y - 1) * 160 + (x - 1)* 2))) = (char)ch; gotoxy((x = ((++x)>80)? 80 : x), y) //ternary expression } //++++++++++++++++++++++++++++++++++++++End Funtion Fillch+++++++++++++++++++++++++++++++++++++++++++++ |
![]() Hot Linksขอบคุณผู้สนับสนุน |
Copyright© 2000-2007, Vcharkarn.Com. All rights reserved.
|
คลิ๊กเพื่อดูสถิติ รับรองและสนับสนุนโดย |
![]() สสวท. |
![]() มูลนิธิ พสวท. |
![]() พสวท. |