C ×Ö·û´®º¯Êý´óÈ«
º¯ÊýÃû: stpcpy
¹¦ ÄÜ: ¿½±´Ò»¸ö×Ö·û´®µ½ÁíÒ»¸ö
ÓÃ ·¨: char *stpcpy(char *destin, char *source);
³ÌÐòÀý:
#include <stdio.h>
#include <string.h>
int main(void)
{
char string[10];
char *str1 = "abcdefghi";
stpcpy(string, str1);
printf("%s\n", string);
return 0;
}
º¯ÊýÃû: strcat
¹¦ ÄÜ: ×Ö·û´®Æ´½Óº¯Êý
ÓÃ ·¨: char *strcat(char *destin, char *source);
³ÌÐòÀý:
#include <string.h>
#include <stdio.h>
int main(void)
{
char destination[25];
char *blank = " ", *c = "C++", *Borland = "Borland";
strcpy(destination, Borland);
strcat(destination, blank);
strcat(destination, c);
printf("%s\n", destination);
return 0;
}
º¯ÊýÃû: strchr
¹¦ ÄÜ: ÔÚÒ»¸ö´®ÖвéÕÒ¸ø¶¨×Ö·ûµÄµÚÒ»¸öÆ¥ÅäÖ®´¦\
ÓÃ ·¨: char *strchr(char *str, char c);
³ÌÐòÀý:
#include <string.h>
#include <stdio.h>
int main(void)
{
char string[15];
char *ptr, c = 'r';
strcpy(string, "This is a string");
ptr = strchr(string, c);
if (ptr)
printf("The character %c is at position: %d\n", c, ptr-string);
else
printf("The character was not found\n");
return 0;
}
º¯ÊýÃû: strcmp
¹¦ ÄÜ: ´®±È½Ï
ÓÃ ·¨: int strcmp(char *str1, char *str2);
¿´AsicÂ룬str1>str2£¬·µ»ØÖµ > 0£»Á½´®ÏàµÈ£¬·µ»Ø0
³ÌÐòÀý:
#include <string.h>
#include <stdio.h>
int main(void)
{
char *buf1 = "aaa", *buf2 = "bbb", *buf3 = "ccc";
int ptr;
ptr = strcmp(buf2, buf1);
if (ptr > 0)
printf("buffer 2 is greater than buffer 1\n");
else
Ïà¹ØÎĵµ£º
1¡¢C/C++³ÌÐòÔ±Çë×¢Ò⣬²»ÄÜÔÚcaseÓï¾ä²»Îª¿Õʱ“ÏòÏÂÖ´ÐД¡£
2¡¢ÖµÀàÐͺÍÒýÓÃÀàÐÍÖ®¼äµÄÇø±ð£ºC#µÄ»ù±¾ÀàÐÍ£¨int£¬charµÈ£©¶¼ÊÇÖµÀàÐÍ£¬ÊÇÔÚÕ»Öд´½¨µÄ¡£¶ø¶ÔÏóÊÇÒýÓÃÀàÐÍ£¬´´½¨ÓÚ¶ÑÖУ¬ÐèҪʹÓùؼü×Önew¡£
3¡¢ÔÚC#ÖÐͨ¹ýʵÀý·ÃÎʾ²Ì¬·½·¨»ò³ÉÔ±±äÁ¿ÊDz»ºÏ·¨µÄ£¬»áÉú³É±àÒëÆ÷´íÎó¡£µ«ÊÇÎÒÃÇ¿ÉÒÔͨ¹ýÉùÃ÷Ëû ......
Gcc¼ò½é
LinuxϵͳϵÄgcc£¨GNU C Compiler£©ÊÇGNUÍƳöµÄ¹¦ÄÜÇ¿´ó¡¢ÐÔÄÜÓÅÔ½µÄ¶àƽ̨±àÒëÆ÷£¬ÊÇGNUµÄ´ú±í×÷Æ·Ö®Ò»¡£gccÊÇ¿ÉÒÔÔÚ¶àÖÖÓ²Ìåƽ̨ÉϱàÒë³ö¿ÉÖ´ÐгÌÐòµÄ³¬¼¶±àÒëÆ÷£¬ÆäÖ´ÐÐЧÂÊÓëÒ»°ãµÄ±àÒëÆ÷Ïà±Èƽ¾ùЧÂÊÒª¸ß20%~30%¡£
gcc ±àÒëÆ÷Äܽ«C¡¢C++ÓïÑÔÔ´³ÌÐò¡¢»ã³Ìʽ»¯ÐòºÍÄ¿±ê³ÌÐò±àÒë¡¢Á¬½Ó³É¿ÉÖ´ÐÐÎļþ£¬Èç¹ûûÓи ......
C\C++Ö§³Ö±È½ÏµÍ½×µÄλÔËË㣬ÔÚÊÇÖÚÈ˽ÔÖªµÄÁË¡£Ã¿±¾C\C++µÄ½Ì¿ÆÊ鶼»á˵µ½Õⲿ·ÖµÄÄÚÈÝ£¬²»¹ý¶¼ºÜ¼òÂÔ£¬ÎÒÏë»áÓкܶàÈ˲»ÖªµÀλÔËËãÓÃÔÚʲôµØ·½¡£Õâ¸öÌû×ӾͼòÂÔ˵˵λÔËËãµÄÓô¦£¬¸ü½øÒ»²½µÄÓ÷¨Òª´ó¼Ò×Ô¼ºÈ¥Ìå»á¡£¶øÖ÷Ҫ˵µÄÊDzÙ×÷±êÖ¾Öµ·½Ãæ¡£
/****************************************/
#define BTI ......
1¡¢Òþʽת»»
CÔÚÒÔÏÂËÄÖÖÇé¿öÏ»á½øÐÐÒþʽת»»:
1¡¢ËãÊõÔËËãʽÖУ¬µÍÀàÐÍÄܹ»×ª»»Îª¸ßÀàÐÍ¡£
2¡¢¸³Öµ±í´ïʽÖУ¬Óұ߱í´ïʽµÄÖµ×Ô¶¯Òþʽת»»Îª×ó±ß±äÁ¿µÄÀàÐÍ£¬²¢¸³Öµ¸øËû¡£
& ......
#include <assert.h>¡¡¡¡¡¡¡¡//É趨²åÈëµã
#include <ctype.h>¡¡¡¡¡¡¡¡ //×Ö·û´¦Àí
#include <errno.h>¡¡¡¡¡¡¡¡ //¶¨Òå´íÎóÂë
#include <float.h>¡¡¡¡¡¡¡¡ //¸¡µãÊý´¦Àí
#include <fstream.h>¡¡¡¡¡¡ //ÎļþÊäÈ룯Êä³ö
#include <iomanip.h>¡¡¡¡¡¡ //²ÎÊý»¯ÊäÈ룯Êä³ö
#include & ......