cµÄIO
²¿·ÖÄÚÈÝÀ´×Ôhttp://www.programfan.com/article/2674.htmlÒÔ¼°http://www.programfan.com/article/showarticle.asp?id=2675
²¿·Ö·ÒëÀ´×ÔTUM skript£¨c programmieren);
1.printf()£º
ǧÍò²»ÒªÒÅÍüÔÚprintf()µÄ×îºóÌí¼ÓNewLine"\n"¡£ÒòΪÔÚcµÄ¿âÖÐͨ³£ÓÐÐлº´æ»úÖÆ£¬Õâ¸öÒâζ×ÅÖ»Óе±Ò»ÐеÄÊäÈëͨ¹ý"\n"½áÊø֮ǰ£¬ÐеÄÊý¾Ý½«»á±»»º´æ£¬Ö®ºó²Å»áÏÔʾ³öÀ´¡£
¸ñʽ£º
% <Êä³ö×îС¿í¶È>.<СÊýλ> ÀàÐÍ
‘-’ºÅΪ×ó¶ÔÆë
2.scanf():
ÐÐÊäÈëµÄ½áÊøÊǸù¾ÝEnter(Carriage Return)À´È·¶¨µÄ£»
×¢ÒâscanfÒª´«ÒýÓ㬶ø¶ÔÓÚÊý×é¶øÑÔ´«Êý×éÃû/Ö¸ÕëÃû¼´¿É£¬±¾Éí¾ÍÊÇÒýÓã»
int iA[10]={...};
scanf("%10d", iA);
¶ÔÓÚscanf¶øÑÔÒ²´æÔÚ»º´æ»úÖÆ£¬ËùÓкÏÊʵ±Ç°Êä³öÁ÷¸ñʽµÄ×Ö·û½«´Ó»º´æÖÐÈ¡³öÖªµÀ³öÏÖ²»ºÏÊʵÄ×Ö·ûλÖã¬ÏÂÒ»´Îscanf½«¼ÌÐø¶Áδ¶ÁÍêµÄ»º´æ×Ö·û£¬Ö»Óе±Õâ´ÎµÄscanf»º´æÖеÄÊý¾ÝÍêÈ«½áÊøºó£¬²ÅÄÜÔÙÆô¶¯ÐµÄscanf»º´æ¡£
ex.1
int a=2,b=2;
scanf("%d",&a);
scanf("%d",&b);
//Èç¹ûÊäÈë
//11.75
//5
Ôò×îºó³öÏÖµÄÊÇaµÄֵΪ11£¬¶øbµÄÖµÒòΪ"."²¢²»ÊÇ%dÀàÐ͵ÄËùÒÔscanf²»ÄܼÌÐø¶Á»º´æÖеÄÖµ£¬ËùÒÔbµÄÖµ½«²»±»¸Ä±ä
×îºóµÄÊä³öʱ a=11£¬b=2£»
ex.2
scanf("%c%c%c",&a,&b,&c);
//ÊäÈëΪ£º
//d e f
//Ôò°Ñ'd'¸³Óèa, ' '¸³Óèb,'e'¸³Óèc¡£Ö»Óе±ÊäÈëΪ£º
//defʱ²ÅÊÇÕýÈ·µÄ
scanfµÄË«ÒýºÅÄÚ²¿¿ÉÒÔÉèÖøñʽ·ûºÅÀýÈç¿Õ¸ñÒÔ¼°tabµÈ£¬µ«Í¬Ê±ÊäÈëÒ²Òª°´ÕÕÕâ¸ö¸ñʽ£¬·ñÔòÒª³öÏÖ´íÎó¡£
3.getchar()
ÍêÕûµÄº¯ÊýʽΪ£ºint getchar(void);
¶ÁÈëµÄΪһ¸ö¸ö×Ö·û£¬·µ»ØֵΪ×Ö·ûasciiÂë¡£
getcharº¯Êýgetcharº¯ÊýµÄ¹¦ÄÜÊÇ´Ó¼üÅÌÉÏÊäÈëÒ»¸ö×Ö·û¡£ÆäÒ»°ãÐÎʽΪ£º getchar(); ͨ³£°ÑÊäÈëµÄ×Ö·û¸³ÓèÒ»¸ö×Ö·û±äÁ¿£¬¹¹³É¸³ÖµÓï¾ä£¬È磺
char c;
c=getchar();#include<stdio.h>
void main(){
char c;
printf("input a character\n");
c=getchar();
putchar(c);
}
¡¡¡¡Ê¹ÓÃgetcharº¯Êý»¹Ó¦×¢Ò⼸¸öÎÊÌ⣺
¡¡¡¡1.getcharº¯ÊýÖ»ÄܽÓÊܵ¥¸ö×Ö·û£¬ÊäÈëÊý×ÖÒ²°´×Ö·û´¦Àí¡£ÊäÈë¶àÓÚÒ»¸ö×Ö·ûʱ£¬Ö»½ÓÊÕµÚÒ»¸ö×Ö·û¡£
¡¡¡¡2.ʹÓñ¾º¯ÊýÇ°±ØÐë°üº¬Îļþ“stdio.h”¡£
4.putchar()
ÍêÕûµÄº¯ÊýʽΪ£ºint putchar(int c);
Ò»¸ö¸ö×Ö·ûµÄÊä³ö£»
#include<stdio.h>
#include <stdio.h>
void main(){
¡¡char a
Ïà¹ØÎĵµ£º
ÀûÓÃÊÀ½ç×îС×î¿ìµÄC±àÒëÆ÷´òÔì×Ô¼ºµÄC±à¼Æ÷
¼ò½étinycc ÊÀ½çÉÏ×îС±àÒëËÙ¶È×î¿ìµÄCÓïÑÔ±àÒëÆ÷ ¸÷ÏÄܽø¹Ù·½È¥¿´
TCC¹Ù·½ÏÂÔصØÖ·£ºhttp://ftp.twaren.net/Unix/NonGNU/tinycc/tcc-0.9.25-win32-bin.zip
ÎÒÖªµÀ ´ó¼Ò»ù±¾É϶¼ÓùýWIN—TC°É ÌرðÊÇÉϹý´óѧµÄ CÓïÑÔÈëÃÅʱÓõĶ¼ÊÇ
ËûµÄ²Ù×÷½çÃæÈçͼ
¹þ¹þ ¿´ÏÂÍ ......
±àÒë³ÌÐò£¬ÌáʾCÅ̿ռ䲻×㣬ÎÒÇåÀícÅ̺ó£¬É¾³ýûÓõÄÈí¼þºó£¬·¢Ïֿռ仹ÊǺÜÉÙ£¬½ö½öÌáÉý200M×óÓÒ£¬ºÜÊÇÆæ¹Ö£¬Îҵÿռ䶼±»Ê²Ã´Õ¼È¥ÁËÄØ£¿
¾¹ý²é¿´£¬·¢ÏÖC:\Documents and Settings\tangh\Application Data\VisualAssistĿ¼¾¹È»ÓÐ5G¶à£¬ÎÒµÄÂèѽ£¬ÉÏÍøÒ»²é£¬ÍøÉÏ˵Ëû˵CÅÌɱÊÖ£¬¸É´àÕ¤ÁË£¬Ã»ÓÐʲôӰÏ죡
......
ÄÚºËÆô¶¯µÄÏÖÔÚÒѾÊÇ¿ªÊ¼Ö´Ðк¯Êýstart_kernelº¯ÊýÁË¡£start_kernelº¯ÊýÔÚinit/main.cÖж¨Òå¡£start_kernelº¯ÊýÖ»ÊÇÍê³É
ÏàÓ¦µÄ½á¹¹µÄ³õʼ»¯ÈÎÎñ¡£
printk(KERN_NOTICE);
printk(linux_banner);
setup_arch(&command_line);
ÔÚubootµÄÒ»Ö±¹ý³ÌÖУ¬uboo ......
1.
printf("%.9lf\n",sum);
//Êä³öСÊýµãºó9λ²»Ê¡È¥Ä©Î²¶àÓàµÄ0
2.
printf("%.10g\n",sum);
//Êä³öСÊýµãºó9λ²»Ê¡È¥Ä©Î²¶àÓàµÄ0
3.
#include<iomanip>
cout<<setprecision(10)<<sum<<endl;
//Êä³öСÊýµãºó9λʡȥĩβ¶àÓàµÄ0
4.
#include<iomanip>
cout.pre ......