c ÓïÑÔÖеÄ×Ö·û´®²Ù×÷
http://blog.chinaunix.net/u1/41817/showart_342390.html
6£®5
ÔõÑù½«×Ö·û´®´òÓ¡³ÉÖ¸¶¨³¤¶È
?
Èç¹ûÒª°´±í¸ñÐÎʽ´òÓ¡Ò»×é×Ö·û´®£¬Äã¾ÍÐèÒª½«×Ö·û´®´òÓ¡³ÉÖ¸¶¨³¤¶È¡£ÀûÓÃ
printf()º¯Êý¿ÉÒԺܷ½±ãµØʵÏÖÕâÒ»µã£¬Çë¿´ÏÂÀý
:
# include <stdio. h>
char * data[25] = {
"REGION", "--Q1--", "--Q2--", "--Q3--", "--Q4--",
"North" , "10090. 50" , "12200. 10" , "26653.12" , "62634. 32" ,
"South", "21662.37", "95843.23", "23788.23", "48279.28",
"East", "23889.38", "23789.05", "89432.84", "29874.48",
"West", "85933.82", "74373.23", "78457.23", "28799.84" };
void main (void) ;
void main (void)
{
int x;
fox (x = 0, x<25; x+ + )
{
if ((x % 5) == 0&&(x !=0))
printf("\n");
printf (" %-10. 10s" , data[x]) ;
}
}
ÔÚÉÏÀýÖУ¬×Ö·û´®Êý×é
char *data[]Öаüº¬ÁËijÄê
4¸öµØÇøµÄÏúÊÛÊý¾Ý¡£ÏÔÈ»£¬Äã»áÒªÇó°´±í¸ñÐÎʽ´òÓ¡ÕâЩÊý¾Ý£¬¶ø²»ÊÇÒ»¸ö°¤Ò»¸öµØºÁÎÞ¸ñʽµØ´òÓ¡ÕâЩÊý¾Ý¡£Òò´Ë£¬ÉÏÀýÖÐÓÃÏÂÊöÓï¾äÀ´´òÓ¡ÕâЩÊý¾Ý£º
printf("%-10£®
10s"£¬
data[x])£»
²ÎÊý
"%-10£®
10s"ָʾ
printf()º¯Êý°´
10¸ö×Ö·ûµÄ³¤¶È´òÓ¡Ò»¸ö×Ö·û´®¡£ÔÚȱʡÇé¿öÏ£¬
printf()º¯Êý°´ÓÒ¶ÔÆë¸ñʽ´òÓ¡×Ö·û´®£¬µ«ÊÇ£¬ÔÚµÚÒ»¸ö
10µÄÇ°Ãæ¼ÓÉϼõºÅ
(-)ºó£¬
prinft()º¯Êý£¬¾Í»áʹ×Ö·û´®×ó¶ÔÆ롣Ϊ´Ë£¬
printf()º¯Êý»áÔÚ×Ö·û´®µÄβ²¿¼ÓÈë¿Õ¸ñ£¬ÒÔʹÆ䳤¶È´ïµ½
10¸ö×
Ïà¹ØÎĵµ£º
PCÖ®¸¸C. ThackerÈÙ»ñ2009ÄêͼÁé½±
2010-03-10 01:21 | 3110´ÎÔĶÁ | ¡¾ÒÑÓÐ16ÌõÆÀÂÛ¡¿·¢±íÆÀÂÛ
¹Ø¼ü´Ê£ºÐÂÎÅ×ÊѶ | ¸ÐлliujiangCEµÄÌṩ | ÊÕ²ØÕâƪ×ÊѶ
¸ù¾ÝACM¹Ù·½ÍøÕ¾3ÔÂ9ÈÕ·¢²¼µÄÏûÏ¢£¬2009ÄêͼÁé½±ÊÚÓèÁËÏÖ´úPCÖ®¸¸Charles Thacker£¬ÒÔ±íÕÃËû¶ÔµÚһ̨ÏÖ´ú¸öÈ˼ÆËã»úXerox PARC Altoµ ......
ubuntuϵÄc/c++»·¾³´î½¨ÊDZȽϼòµ¥,ÒòΪÓÐaptºÍÐÂÁ¢µÃµÄ°ïÖú.
1.
Ê×ÏÈÊÇÅäÖÃgcc,ÔÚubuntu°²×°Íê³ÉÒѾÓÐgccÁË(gccÊÇÓÉGNUÖ®¸¸StallmanËù¿ª·¢µÄlinuxϵıàÒëÆ÷£¬È«³ÆΪGNU
Compiler Collection£¬ Ä¿Ç°¿ÉÒÔ±àÒëµÄÓïÑÔ°üÀ¨£ºC, C++, Objective-C, Fortran, Java,
and
Ada.).µ«ÊÇgcc»¹²»ÄܱàÒëÎļþ.ÒòΪȱÉÙһЩͷÎļþ.Ä ......
#include <stdio.h>
unsigned int reverse_bits(unsigned int value)
{
unsigned int answer;
unsigned int i;
answer = 0;
for(i=1;i!=0;i<<=1){ //´ËÑ»·¿ÉÒÔºöÂÔ»úÆ÷µÄ²îÒì¡£64λºÍ32λ½Ô¿ÉÓã¬Ôö ......
±¾ÎÄÊÇд¸ø gcc ÐÂÊÖµÄÈëÃÅÎÄÕ£¬ËùÒÔÄÚÈݱȽϼòµ¥¡£Èç¹ûÄãÖªµÀÏÂÃæ3ÌõÃüÁ¿ÉÒÔ±àÒëc++µÄ»°£¬¾Í²»ÓÃÔÚ±¾ÎÄÀË·Ñʱ¼äÁË
´úÂë:
g++ -Wall hellocpp.cpp
gcc -Wall hellocpp.cpp -lstdc++
gfortran -Wall hellocpp.cpp -lstdc++
×¢£º±¾ÎÄ×îаæÔÚwikiÖÐ http://wiki.ubuntu.org.cn/Gcchowto
£¨½¨Òé´ó¼ÒÖ±½Ó·ÃÎÊwikiÖ ......