C/C++×Ö·û´®Æ¥ÅäºÍÌæ»»
ÌâÄ¿£ºÊäÈëÈý¸ö×Ö·û´®a£¬bºÍc£¬½«aÖÐbµÄµÚÒ»´Î³öÏÖÌ滻Ϊc¡£
´úÂ룺
#include <iostream.h>
#include <string.h>
/*×Ö·û´®Ìæ»»£¬µÚÒ»¸ö²ÎÊýΪԴ®£¬µÚ¶þ¸ö²ÎÊýΪҪƥÅäµÄ×Ó´®
µÚÈý¸ö²ÎÊýΪҪÌæ»»µÄµÚÒ»¸ö×Ó´®Öаüº¬µÚ¶þ¸ö×Ó´®µÄ²¿·Ö*/
char *strReplace(char *str1,char *str2,char *str3);
void main()
{
char str1[255]={'\0'},str2[255]={'\0'},str3[255]={'\0'};
cin>>str1;
cin>>str2;
cin>>str3;
strcpy(str3,strReplace(str1,str2,str3));
cout<<str3<<endl;
}
/*×Ö·û´®²éÕÒÆ¥Å亯Êý£¬²éÕÒµÚ¶þ¸ö×Ö·û´®ÔÚµÚÒ»¸ö×Ö·û´®ÖеÄλÖÃ*/
//ÌÎÌÎÈÏΪ×Ô¼ºÐ´µÄÕâ¸ö×Ö·û´®Æ¥Å亯Êý»¹ÊǺÜÓÐʹÓüÛÖµµÄ£¬ÕýÔÚѧϰ
int strSearch(char *str1,char *str2)
{
int at,flag=1;
if (strlen(str2) > strlen(str1))
{
at = -1;
}
else if (!strcmp(str1,str2))
{
at = 0;
}
else
{
unsigned i=0,j=0;
for (i=0;i < strlen(str1)&&flag;)
{
for (j=0;j < strlen(str2)&&flag;)
{
&
Ïà¹ØÎĵµ£º
Cº¯ÊýÒªÔÚ³ÌÐòÖÐÓõ½ÒÔÏÂÕâЩºê:
void va_start( va_list arg_ptr, prev_param );
type va_arg( va_list arg_ptr, type );
void va_end( va_list arg_ptr );
va_list:ÓÃÀ´±£´æºêva_start¡¢va_argºÍva_endËùÐèÐÅÏ¢µÄÒ»ÖÖÀàÐÍ¡£ÎªÁË·ÃÎʱ䳤²ÎÊýÁбíÖеIJÎÊý£¬±ØÐëÉùÃ÷
& ......
Ðí¶à±à³ÌÓïÑÔÖеĵ÷Óú¯ÊýµÄÁ½ÖÖ·½·¨ÊÇ°´Öµµ÷ÓÃ(call-by-value)ºÍ°´ÒýÓõ÷ÓÃ(call-by-reference)¡£
²ÎÊý°´Öµµ÷Óô«µÝʱ£¬Éú³É²ÎÊýÖµ¸±±¾²¢ÇÒ´«¸ø±»µ÷Óú¯Êý£¬¸±±¾µÄ¸Ä±ä²¢²»Ó°Ïìµ÷ÓÃÕßµÄÔʼ±äÁ¿Öµ£¬ÕâÑù¾Í¿ÉÒÔ·ÀÖ¹ÒâÍâµÄ¸±×÷ÓÃÓ°Ï쿪·¢ÕýÈ·£¬¿É¿¿µÄϵͳ¡£°´Öµµ÷ÓõÄÒ»¸öȱµãÊÇ£¬Èç¹û´«µÝ½Ï´óµÄÊý¾ÝÏÔò¸´ÖÆÕâ¸öÊý ......
ÑòÈÞ±»ÊÇÒÔɽÑòÈÞΪԲÄÁÏÕëÖ¯Îï¶ø³ÉµÄ´²ÉÏÓÃÆ·,ÒÀ¾ÝÉ´ÏßÖÖÀà·Ö³É´Ö·Ä֯ƷºÍ¾«·ÄÕëÖ¯ÎïÁ½ÖÖ,ÒÀ¾ÝÔ²ÄÁϱÈÖµ¿ÉÒԷֳɴ¿ÑòÈÞ¼°ÑòÈÞ»ì·ÄÁ½ÖÖ¾¼Ó¹¤¶ø³ÉµÄÉú»îÓÃÆ·£¬¹©Å¯ÐԺ㬸Ç×ÅÊæ̹£¬¾¡ÏԸߵµ¾×½À¡£ ±¾ÎÄÀ´Ô´£º¸ÊËàÇìÑôÌÚ´ïÉÌó ......
1.1= Óë ==
Àý1£º
±¾ÀýÖÐÑ»·Óï¾äµÄ±¾ÒâÊÇÌø¹ýÎļþÖеĿոñ·û¡¢ÖƱí·û¡¢»»Ðзû
while(c=''||c=='\t'||c=='\n')
c=getc(f);
c= ''||c=='\t'||c=='\n'
ËÀÑ»·
Àý2£º
if((filedesc==open(argv[i],0))<0)
error();
ÓÀÔ¶²»»á±»µ÷ÓÃ
1.2 & ºÍ | ²»Í¬ÓÚ&& ºÍ||
1.3 CÓ ......
º¯ÊýÃû: abort
¹¦ ÄÜ: Òì³£ÖÕÖ¹Ò»¸ö½ø³Ì
ÓÃ ·¨: void abort(void);
³ÌÐòÀý:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Calling abort()\n");
abort();
return 0; /* This is never reached */
}
......