c³ÌÐòÉè¼ÆÓïÑÔÏ°Ìâ1 9
ÁªÏµ1-9±àдһ¸ö½«ÊäÈ븴ÖƵ½Êä³öµÄ³ÌÐò£¬²¢½«ÆäÖÐÁ¬ÐøµÄ¶à¸ö¿Õ¸ñÓÃÒ»¸ö¿Õ¸ñ´úÌæ¡£
#include "stdio.h"
main(){
int c;
int flag;
flag=0;//ÊÇ·ñ¿Õ¸ñ±êÖ¾
while ((c=getchar())!=EOF){
if (c!=32) {
putchar(c);
flag=0;
}else if(flag==0){
flag=1;
putchar(c);
}
/*if(c==32 && flag==0){
flag=1;
putchar(c);
continue;
}
if(c!=32){
putchar(c);
flag=0;
}*/
}
}
Ïà¹ØÎĵµ£º
ÔÚ±à³ÌµÄ¹ý³ÌÖУ¬ÎļþµÄ²Ù×÷ÊÇÒ»¸ö¾³£Óõ½µÄÎÊÌ⣬ÔÚC++BuilderÖУ¬¿ÉÒÔʹÓöàÖÖ·½·¨¶ÔÎļþ²Ù×÷£¬ÏÂÃæÎҾͰ´ÒÔϼ¸¸ö²¿·Ö¶Ô´Ë×÷Ïêϸ½éÉÜ£¬¾ÍÊÇ£º
1¡¢»ùÓÚCµÄÎļþ²Ù×÷£»
2¡¢»ùÓÚC++µÄÎļþ²Ù×÷£»
3¡¢»ùÓÚWINAPIµÄÎļþ²Ù×÷£»
4¡¢»ùÓÚBCB¿âµÄÎļþ²Ù×÷£»
5¡¢ÌØÊâÎļþµÄ²Ù×÷¡£
¡¡
Ò¼¡¢»ùÓÚCµÄÎļþ²Ù×÷
¡¡¡¡ÔÚANSI CÖУ¬ ......
¹ØÓڼǺÅÕ³Ìù²Ù×÷·û(token paste operator): ##
1. ¼òµ¥µÄ˵£¬“##”ÊÇÒ»ÖÖ·Ö¸ôÁ¬½Ó·½Ê½£¬ËüµÄ×÷ÓÃÊÇÏÈ·Ö¸ô£¬È»ºó½øÐÐÇ¿ÖÆÁ¬½Ó¡£
ÆäÖУ¬·Ö¸ôµÄ×÷ÓÃÀàËÆÓÚ¿Õ¸ñ¡£ÎÒÃÇÖªµÀÔÚÆÕͨµÄºê¶¨ÒåÖУ¬Ô¤´¦ÀíÆ÷Ò»°ã°Ñ¿Õ¸ñ
½âÊͳɷֶαêÖ¾£¬¶ÔÓÚÿһ¶ÎºÍÇ°Ãæ±È½Ï£ ......
¼ÙÉèÓÐchar a[2];
ÈçÒª°Ñaת»»ÎªintÖµ¡£Ó¦ÊÇÈçÏÂд·¨int b=*(int *)a;
¼´£¬ÏÈ°ÑÖ¸Õëa ת»»ÎªÒ»¸öintÖ¸Õ룬ȻºóÔÙ´Ë»ù´¡ÉÏÈ¡Öµ¡£
µ«ÊÇÁíÒ»ÖÖд·¨ int b=(int)(*a);ÊDz»¶ÔµÄ£¬*a È¡aµÄÄÚ´æµ¥ÔªÄÚÈÝ£¬ÒòΪÏÖÔÚaÊÇcharÖ¸Õ룬ËùÒÔÖ»»áÈ¡a[1]ÖÐÄÚÈÝ£¬×î´óΪ255. ÕâÀïҪ˵Ã÷µÄÊÇ£¬ÔÚ°Ñchar»òbyteÊý×éת»»ÎªÆäËûÀàÐ͵Äֵʱ£¬ÒªÏÈ ......
#include <stdio.h>
#include <string.h>
int
main(void)
{
char str[] =
"3BVPSq4xF.K?=u#,"
"G'K<MrDnRr7gH%#,"
"XKf<f%G`w^=?C<#,"
"HgU_AnNR?*PDQU#,"
......
µ±LinuxÄÚºËÔÚÌåϵ½á¹¹²îÒì½Ï´óµÄƽ̨֮¼äÒÆֲʱ£¬»á²úÉúÓëÊý¾ÝÀàÐÍÏà¹ØµÄÎÊÌâ¡£
.ÔÚ±àÒëÄÚºËʱʹÓà -Wall -W strict-prototypes Ñ¡Ïî, ¿ÉÒÔ±ÜÃâºÜ¶à´íÎóµÄ·¢Éú
.ÄÚºËʹÓõĻù±¾Êý¾ÝÀàÐÍÖ÷ÒªÓÐ:
int ±ê×¼CÓïÑÔÕûÊýÀàÐÍ
&n ......