Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C/C++·ç¸ñ×Ö·û´®

Ò»£º×Ö·û´®ÀàÐÍ·ÖÀࣺ
1.       C·ç¸ñ×Ö·û´®£ºÆðÔ´ÓÚC£¬²¢ÔÚC++Öеõ½Ö§³Ö¡£
a.       ´æ´¢·½Ê½£º±»´æ´¢ÔÚÒ»¸ö×Ö·ûÊý×éÖУ¬Í¨¹ýÒ»¸öchar*ÀàÐ͵ÄÖ¸ÕëÀ´²Ù×ÝËü¡£
b.       ÌṩµÄ¿âº¯Êý£º°üº¬Í·Îļþ£º#include<cstring>
a)         int strlen( const char* );//·µ»Ø×Ö·û´®µÄ³¤¶È
b)        int strcmp( const char*, const char* );//±È½ÏÁ½¸ö×Ö·û´®ÊÇ·ñÏàµÈ
c)        char* strcpy( char*, const char* );//°ÑµÚ¶þ¸ö×Ö·û´®¿½±´µ½µÚÒ»¸ö×Ö·û´®ÖÐ
#include <iostream>
#include <cstring>
#include <stdio.h>
using namespace std;
void main()
{
    char* arraya = "hello world!";
    int c;
    c = strlen(arraya);
    cout<<c<<endl;
    char arrayb[80];
    char * test = NULL;
    test = strcpy (arrayb, arraya);
    cout<<"test is: "<<test<<endl;
    cout<<arrayb<<endl;
    int d;
    d = strcmp(arrayb,arraya);
    cout<<endl<<"d->"<<d<<endl;
}Õâ¶Î´úÂë°üº¬ÁËÒÔÉÏÈý¸ö¿âº¯ÊýµÄʹÓá£
¶þ£ºc++·ç¸ñµÄstring
1.       ÎÒÃÇʹÓÃstring£¬ËüµÄ¿âº¯ÊýÓкܶ࣬µ±ÎÒÃÇÐèÒª»ñµÃij¸ö×Ö·û´®µÄ³¤¶ÈµÄʱºò£¬¿ÉÒÔµ÷ÓÃsize()º¯Êý£º
ÕâÀïÎÒÃǶ¨ÒåÒ»¸östring£ºstring sa = “hello world!”;
1£©  ÎÒÃǵ÷ÓÃsize()º¯Êý£ºsa.size();ËüµÄÖµ¾ÍÊÇ12£»
2£©  ÎÒÃÇÐèÒªÅжÏÒ»¸ö×Ö·û´®ÊÇ·ñΪ¿ÕµÄʱºò£¬ÎÒÃÇ¿ÉÒÔµ÷ÓÃempty()º¯ÊýÀ´Åжϣºsa.empty();ÈôÕâ¸ö×Ö·û´®Îª¿Õ£¬ÄÇôËü½«·µ»Ø1£¬Èô²»Îª¿Õ£¬Ôò·µ»Ø0¡£
3£©  ÎÒÃÇ»áÓõ½¿½±´×Ö·û´®µÄÇé¿ö£¬ÔÚÎÒÃdzõʼ»¯Ò»¸ö×Ö·û´®µÄʱºò£¬ÎÒÃÇ¿ÉÒÔ³õʼ»¯³ÉÒ»¸ö×Ö·û´®µÄ¿½±´£ºstring sc(sa);ÔÚÕâ¶Î´úÂëºó£¬scµÄÄÚÈݺÍsa¾ÍÍêÈ«ÏàͬÁË¡£ÎÒÃÇ¿ÉÒÔʹÓÃÒ»¸öÅжÏÓï¾äÀ´ÅжÏÕâÁ½¸ö×Ö·û´®ÊÇ·ñÏàµÈ£ºif( sc == sa)…
&nb


Ïà¹ØÎĵµ£º

C/C++ӦƸ×ܽá[ÌرðÍƼö¸ø´óÈýµÄѧµÜѧÃÃÃÇ]


¸ãÈí¼þÊÇÓиãÍ·µÄ
——×ÞÆî·å
2009Äê12ÔÂ3ÈÕ
 
ÉùÃ÷£ºËù˵µÄÖ»Õë¶ÔC¡¢C++¡¢.NETרҵµÄͬѧ£¬¶ÔÆäËûרҵҲÐíûÓвο¼¼ÛÖµ£¡
[ÍƼö¸ø´óÈýµÄѧµÜѧÃÃÃÇ]
¡¾»¶Ó­¸÷λÅóÓѲ¹³ä¡¿
 
    ¶ÔÎÒ¸öÈ˶øÑÔ£¬´óѧ±ÏÒµÕÒ¹¤×÷ËãÊÇ»­ÉÏÁËÒ»¸öÐí¶àÈËÏÛĽ£¬µ«ÎÒ×Ô¼ºÈÔ¸ÐÒź¶µÄ¾äºÅ¡£ÕÒ¹¤×÷ÆÚ¼ä ......

C++ÖÐextern ¡°C¡±º¬ÒåÉî²ã̽Ë÷

1.ÒýÑÔ
¡¡¡¡C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾ ......

c/c++±ÊÊÔ


1£®½ø³ÌºÍÏ̵߳IJî±ð¡£
Ïß³ÌÊÇÖ¸½ø³ÌÄÚµÄÒ»¸öÖ´Ðе¥Ôª,Ò²Êǽø³ÌÄڵĿɵ÷¶ÈʵÌå.
Óë½ø³ÌµÄÇø±ð:
(1)µ÷¶È£ºÏß³Ì×÷Ϊµ÷¶ÈºÍ·ÖÅäµÄ»ù±¾µ¥Î»£¬½ø³Ì×÷ΪӵÓÐ×ÊÔ´µÄ»ù±¾µ¥Î»
(2)²¢·¢ÐÔ£º²»½ö½ø³ÌÖ®¼ä¿ÉÒÔ²¢·¢Ö´ÐУ¬Í¬Ò»¸ö½ø³ÌµÄ¶à¸öÏß³ÌÖ®¼äÒ²¿É²¢·¢Ö´ÐÐ
(3)ÓµÓÐ×ÊÔ´£º½ø³ÌÊÇÓµÓÐ×ÊÔ´µÄ¶ÀÁ¢µ¥Î»£¬Ï̲߳»ÓµÓÐϵͳ×ÊÔ´£¬µ«¿ÉÒ ......

CÕûÐÍÉý¼¶ºÍÑ°³£ËãÊõת»»

                                                   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ