1.±ê×¼IOÎļþ²Ù×÷
1.1 ±ê×¼IO--->CÓïÑÔÌṩµÄ±ê×¼IO¿â<stdio.h>
1.1.1 printf
º¯ÊýÔÐÍ£ºint printf(constchar *format, ...);
Ó÷¨£ºprintf(¡°printf =%d\n¡±, num);
»áÖ±½Ó°Ñ¸ñʽ·ûÀïµÄ×Ö·û´®´òÓ¡³öÀ´
1.1.2 scanf
º¯ÊýÔÐÍ£ºint scanf(constchar *format, ...);
Ó÷¨£ºscanf(¡°%d¡±,&num);
ÐèÒª°Ñ¸ñʽ·ûÀïµÄ×Ö·û´®ÄÚÈÝ°´ÕÕ¸ñʽ½øÐÐÊäÈë²Å¿ÉÒÔÕý³£Ê¹ÓÃ
1.1.3 sprintf
º¯ÊýÔÐÍ£ºint sprintf(char*str, const char *format, ...);
Ó÷¨£ºsprintf(buf,¡±%d¡±,buf);
×Ö·û´®Æ´½Óº¯Êý£¬°Ñnum°´ÕÕconst char*format¸ñʽ£¬Æ´½Óµ½str»º´æÇøÀï
1.1.4 sscanf
º¯ÊýÔÐÍ£ºint sscanf(constchar *str, const char *format, ...);
Ó÷¨£ºsscanf(buff, ¡°%d¡±,&num);
½øÐÐÊý¾Ý¸ñʽת»»£¬×¢Òâ¸ñʽµÄ¿ØÖÆ£¬²»Òª³ö´í£¬ÌáÈ¡×Ö·û´®µÄʱºò£¬Ö»ÓÐÓöµ½¿Õ¸ñ²Å»áÍ£Ö¹£¬·ñÔò»á°Ñ·ûºÏASCIIÂëµÄ×Ö·û¶¼ÌáÈ¡×ß
ÀýÈçsscanf(¡°12345678qasdfgdsadfg¡±,¡±%d¡±,&num);
1.1.5 gets
º¯ÊýÔÐÍ£ºchar *gets(char*s);
Ó÷¨£ºgets(buf);
´ÓÖն˻ñÈ¡Ò»¸ö×Ö·û´®£¬°Ñ×Ö·û´®´æ´¢µ½bufÖУ¬¸úscanfµÄÇø±ðÔÚÓÚÊÇ·ñÄܽÓÊÕ¿Õ¸ñ
scanfÓöµ½¿Õ¸ñ»òÕ߻سµ¾Í½áÊø£¬¿Õ¸ñ»òÕ߻سµ»á±»ÁôÔÚ»º´æÇø
getsÓöµ½¿Õ¸ñ²»»á½áÊø£¬Óöµ½»Ø³µ»á½áÊø£¬²»»á½ÓÊջسµ£¬µ«Êǻسµ»á´Ó»º´æÇøÖб»Çå³ýµô
1.1.6 puts
º¯ÊýÔÐÍ£ºint puts(constchar *s);
Ó÷¨£ºputs(buf);
putsÖ»ÄÜÊä³ö×Ö·û´®£¬»á×Ô¶¯»»ÐÐ
printf¿ÉÒÔ½øÐÐÊä³ö¸ñʽ¿ØÖÆ£¬printf²»»á×Ô¶¯»»ÐÐ
1.1.7 getchar
º¯ÊýÔÐÍ£ºintgetchar(void);
×÷Ó㺴ÓÖն˻ñÈ¡Ò»¸ö×Ö·û£¬Í¨¹ý·µ»ØÖµ½ÓÊÕ£¬ÐèÒªÓûسµ½áÊøÊäÈ룬¶ø»Ø³µ»á±»ÁôÔÚ»º´æÇøÖÐ
1.1.8 putchar
º¯ÊýÔÐÍ£ºint putchar(intc);
ÍùÖÕ¶ËÊä³ö×Ö·ûc
1.1.9 getc
º¯ÊýÔÐÍ£ºint getc(FILE*stream);
´ÓÎļþÁ÷streamÖлñÈ¡Ò»¸ö×Ö·û£¬Í¨¹ý·µ»ØÖµ·µ»Ø
Èç¹ûÎļþÁ÷ÊÇstdin£¬ÄÇô¸úgetcharÒ»¸öЧ¹û
1.1.10 putc
º¯ÊýÔÐÍ£ºint putc(int c,FILE *stream);
ÍùÎļþÁ÷streamÖÐÊä³öÒ»¸ö×Ö·ûc
Èç¹ûÎļþÁ÷ÊÇstdout£¬ÄÇô¸úputcharÒ»¸öЧ¹û
1.1.11 getch
Í·Îļþ£º#include<curses.h>
º¯ÊýÔÐÍ£ºint getch(void);
×÷Ó㺼üÖµ»ñÈ¡º¯Êý£¬²»ÐèҪʹÓûسµ£¬Ö±½Ó»á»ñÈ¡
ʹÓÃÕâ¸öÍ·Îļþ£¬ÐèÒªÔÚ±àÒëµÄʱºò£¬Á´½ÓÉ϶ÔÓ¦µÄ¶¯Ì¬¿â ¨Clcurses
ÔÚº¯ÊýÖУ¬Ê¹Óõ½´Ëº¯Êý֮ǰ£¬ÐèÒªµ÷ÓÃinitscr()º¯Êý£¬À´½øÐжÔÓ¦µÄ³õʼ»¯
½áÊø֮ǰ£¬ÒªÊ¹Óú¯Êýendwin()£¬½áÊøʹÓÃ