C++ÓëCµÄÇø±ð
±±º£
1£© º¯ÊýÉùÃ÷
l CÈç¹û²»Ð´·µ»ØÖµ£¬Ä¬ÈÏÊÇint£¬¶øC++Öв»Äܲ»Ð´·µ»ØÖµ(¿ÉÓÃvoid±íʾÎÞ·µ»ØÖµ)¡£
ÈçFunc1();
l int Func1()ÔÚCÖбíʾ¿É´øÈÎÒâ²ÎÊýµÄº¯Êý£¬ÕâÊÇCµÄ©¶´£¬Ê¹µÃËü±Ü¿ªÁ˲ÎÊýÀàÐͼì²é£»¶øC++Öбíʾ²»´ø²ÎÊýµÄº¯Êý¡£
2£© Í·ÎļþµÄÇø±ð
l C++µÄÍ·ÎļþÈ¥µôÁËCÖеÄ.h£¬ÒÔcǰ׺¿ªÊ¼¡£±ÈÈ磬<stdio.h> <stdlib.h>±äΪ<cstdio> <cstdlib>
l C´ø.hµÄÊÇ·ÇÄ£°å»¯µÄÍ·Îļþ£¬¶øC++ÊÇÄ£°å»¯µÄÍ·Îļþ¡£
.hÎļþÊDz»º¬ÃüÃû¿Õ¼äµÄ£¬ËùÒÔÒÔÇ°µÄ<iostream.h>ÊDz»ÐèÒªusingµÄ¡£
µ±È»Ò²¿ÉÒÔÓÃÀϵÄCÍ·Îļþ£¬µ«ÊÇ£¬ÔÚͬһ¸ö³ÌÐòÀï²»ÄÜ»ì×ÅÓã¬ËäÈ»±àÒë¿ÉÒÔͨ¹ý£¬µ«ÊÇ¿ÉÄÜ»á³öÏÖÎÊÌâ¡£
3£© register±äÁ¿
ÔÚCÓïÑÔÖУ¬ÊDz»ÄܶÔregister±äÁ¿È¡µØÖ·µÄ£¬ÒòΪËüûÓÐÐéµØÖ·£¬ÔڼĴæÆ÷Àï¡£¶øC++ÖУ¬ËüÊÇ¿ÉÒÔÈ¡Ö·µÄ£¬Õâʱ£¬C++±àÒëÆ÷»áºöÂÔregister£¬²»»á°ÑËü·Åµ½¼Ä´æÆ÷Àï¡£
4£© const±äÁ¿
CÖУ¬constÊÇÖ»¶ÁµÄ±äÁ¿£¬²»Êdz£Á¿£»C++ÖÐËüÊdz£Á¿¡£Çø±ðÓÃÀý×ÓÃèÊöÈçÏ£º
const int MAX = 10;
char buffer[MAX]; //CÖÐËüÊDz»ºÏ·¨µÄ£¬¿ÉÒÔÓÃenum»òdefineÌæ´ú£»
//C++ÖÐËüÊǺϷ¨µÄ¡£
±¾ÖÊ£ºCÖÐconst±äÁ¿·ÖÅäÔÚÈ«¾Ö¾²Ì¬Çø£»C++ÖÐÔòÔÚ³£Á¿Çø£¬±àÒë¹ý³ÌÖÐÖµ¾Í¶¨ÁË¡£
5£© typedef
ÔÚCÖУ¬
struct A
{
};
A a; //ÕâÊÇ´íÎóµÄ£¬ÔÚC++ÖÐÊǺϷ¨µÄ¡£
struct A a; //ÕâÊÇÕýÈ·µÄ
ÓÃÁËtypedefºó£¬CÖÐA a;Ò²ÊǺϷ¨µÄÁË¡£
6£© struct/union/class
l ¶ÔÓÚstruct/unionÊý¾Ý³ÉÔ±Ó뺯Êý³ÉÔ±µÄ·ÃÎÊÐÔÀ´Ëµ£¬ÆäĬÈÏÊÇpublic£»
l classÔòÊÇprivate¡£
l unionÁªºÏÌå²»ÄÜ×÷Ϊ»ùÀà¼Ì³Ð¡£
union A
{
};
class B: public A //±àÒë³ö´í
{
};
l ÄäÃûunion
union
{
int a;
float b;
};
ÔÚ³ÌÐòÀï¿ÉÒÔÖ±½Ó·ÃÎÊ
Ïà¹ØÎĵµ£º
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê5ÔÂ8ÈÕ, ÏÂÎç2:47
*/
#include <iostream>
using namespace std;
class A{
public:
A(){
cout << "Ö´Ðй¹Ô캯Êý´´½¨Ò»¸ö¶ÔÏó" << endl;
}
A(A&){
cout << "Ö´Ðп½±´º¯Êý¿½±´Ò»¸ö¶ ......
Technorati ±êÇ©: C++ ÔÎĵØÖ·£ºhttp://www.byvoid.com/blog/c-int64/ ÔÚC/C++ÖУ¬64ΪÕûÐÍÒ»Ö±ÊÇÒ»ÖÖûÓÐÈ·¶¨¹æ·¶µÄÊý¾ÝÀàÐÍ¡£ÏÖ½ñÖ÷Á÷µÄ±àÒëÆ÷ÖУ¬¶Ô64ΪÕûÐ͵ÄÖ§³ÖÒ²ÊDZê×¼²»Ò»£¬ÐÎ̬¸÷Òì¡£Ò»°ãÀ´Ëµ£¬64λÕûÐ͵Ķ¨Ò巽ʽÓÐlong longºÍ__int64Á½ÖÖ(VC»¹Ö§³Ö_int64)£¬¶øÊä³öµ½±ê×¼Êä³ö·½Ê½ÓÐprintf(¡°%lld¡±,a)£¬printf ......
1¡¢http://snippets.dzone.com/tag/c/ --ÊýÒÔǧ¼ÆµÄÓÐÓõÄCÓïÑÔÔ´´úÂëƬ¶Î
2¡¢http://www.hotscripts.com/category/c-cpp/scripts-programs/ Hotscripts --ÌṩÊýÒ԰ټƵÄCºÍC++½Å±¾ºÍ³ÌÐò¡£ËùÓгÌÐò¶¼·ÖΪ²»Í¬µÄÀà±ð¡£
3¡¢http://www.planetsourcecode.com/vb/default.asp?lngWId=3 --³¬¹ýÍòÐÐCºÍC++Ãâ·ÑµÄÔ´´úÂë
4¡ ......
ºÃ¾ÃÒÔÇ°×öµÄÒ»¸ö³ÌÐò£¬Ì°ÐIJßÂÔʵÏÖ±³°üÎÊÌ⣬cʵÏÖ¡£
×ܽáÔÚÕâÀÒÔ±¸ÒÔºóºÍ±ðÈ˲éÕÒ¡£
//±³°üÎÊÌâ
#include "stdio.h"
#define MAX 10
void main()
{
int w[MAX]={0,10,130,15,60,25}; //´æ·ÅÖÊÁ¿
int v[MAX]={0,30,5,10,20,25}; //´æ·Å¼ÛÖµ
flo ......
C/C++ Reference
http://www.cppreference.com/
C++ Library Reference
http://www.cplusplus.com/ref/
Standard C++ Library Class Reference at Rogue Wave
http://www.roguewave.com/support/docs/hppdocs/stdref/
Dink ......