C: ÃæÏò¶ÔÏó(2)
ÑÝʾÈçºÎÓÃCʵÏּ̳У¬ÖØÔØÖ®ÀàµÄÍæÒÕ¶ù¡£VC++6.0±àÒëͨ¹ý¡£
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef class
#define class struct
#endif
#ifndef private
#define private
#endif
#ifndef public
#define public
#endif
#ifndef protected
#define protected
#endif
#ifndef bool
#define bool int
#endif
#ifndef true
#define true 1
#endif
#ifndef false
#define false 0
#endif
class Parent{
//private members
private class Parent *this;
private char *name;
//public members
public void (*construct)(class Parent *this);
public bool (*setName)(class Parent *this, const char *name);
public char* (*getName)(class Parent *this);
public void (*destruct)(class Parent *this);
};
class Son{
//private members
private class Son *this;
//inherit properties from Parent, we use a pointer here to simulate inheritance
private class Parent *inherit;
//add new members
private char* addr;
//public members
public bool (*construct)(class Son *this);
public bool (*setName)(class Son *this, const char *name);
public char* (*getName)(class Son *this);
public bool (*setAddr)(class Son *this, const char *addr);
public char* (*getAddr)(class Son *this);
public void (*destruct)(class Son *this);
};
//foward declaration
//-----Members for Parent begin
void ParentConstruct(class Parent *this);
bool setName(class Parent *this, const char *name);
char *getName(class Parent *this);
void ParentDestruct(class Parent *this);
//-----Mmmbers for Parent end
//----Members for Son begin
bool SonConstruct(clas
Ïà¹ØÎĵµ£º
1¡¢ int a=2,b=11,c=a+b++/a++; ÔòcֵΪ¶àÉÙ£¿
¡¾¿¼µã¡¿±àÂë¹æ·¶¡£
±íÃæÉÏ¿¼²ìÄã¶ÔÔËËã·ûÓÅÏȼ¶µÄÕÆÎճ̶ȣ¬µ«Êµ¼ÊÉÏÓÅÏȼ¶ÕâÐ©ÍæÒâºÜÄÑËÀ¼ÇÓ²±³µÃס£¿´ó¼ÒµÄÒɻ󲻾ÍÊÇÔËËã·ûµÄ½áºÏ˳Ðòô£¿ÄÇôÈçºÎÈ¥±ÜÃâÄØ£¿c=a+((b++)/(a++))²»¾ÍÐÐÁËô£¬ÆäʵÎÊÌâ±³ºó¿¼²ìµÄÊÇÄãµÄ±àÂë¹æ·¶£¬ÈçºÎдÇåÎúÒ×¶®µÄ´úÂ룬ÈçºÎÔÚÒ»¸öÍÅ ......
ΪÁËÓÃvcдһ¸ö×î¼òµ¥µÄ socket ³ÌÐò£¬»¨·ÑÁËÒ»¸öÏÂÎçµÄʱ¼ä£¬¹ý³ÌÖгöÏֵĴíÎóÓУº
'SOCKET' : illegal use of this type as an expression
syntax error : missing ';' before 'type'
syntax error : identifier 'InitWinsock' --> bool InitWinsock( ......
Ò»¡¢»ñÈ¡ÈÕÀúʱ¼ä
time_tÊǶ¨ÒåÔÚtime.hÖеÄÒ»¸öÀàÐÍ£¬±íʾһ¸öÈÕÀúʱ¼ä£¬Ò²¾ÍÊÇ´Ó1970Äê1ÔÂ1ÈÕ0ʱ0·Ö0Ãëµ½´ËʱµÄÃëÊý£¬ÔÐÍÊÇ£º
typedef long time_t; /* time value */
¿ÉÒÔ¿´³ötime_tÆäʵÊÇÒ»¸ö³¤ÕûÐÍ£¬ÓÉÓÚ³¤ÕûÐÍÄܱíʾµÄÊýÖµÓÐÏÞ£¬Òò´ËËüÄܱíʾµÄ×î³Ùʱ¼äÊÇ2038Äê ......
Á´½Óָʾ·ûextern C
Èç¹û³ÌÐòԱϣÍûµ÷ÓÃÆäËû³ÌÐòÉè¼ÆÓïÑÔÓÈÆäÊÇC дµÄº¯ÊýÄÇôµ÷Óú¯Êýʱ±ØÐë
¸æËß±àÒëÆ÷ʹÓò»Í¬µÄÒªÇóÀýÈçµ±ÕâÑùµÄº¯Êý±»µ÷ÓÃʱº¯ÊýÃû»ò²ÎÊýÅÅÁеÄ˳Ðò¿ÉÄÜ
²»Í¬ÎÞÂÛÊÇC++º¯Êýµ÷ÓÃËü»¹ÊÇÓÃÆäËûÓïÑÔдµÄº¯Êýµ÷ÓÃËü
³ÌÐòÔ±ÓÃÁ´½Óָʾ·ûlinkage directive ¸æËß±àÒëÆ÷¸Ãº¯ÊýÊÇÓÃÆäËûµÄ³ÌÐòÉè¼ÆÓïÑÔ
±àдµ ......
ÃüÁîÐнçÃæµÄ³ÌÐò£¬Í¨³£¶¼ÐèÒªÊäÈëÃüÁîÐвÎÊý°ïÖú³ÌÐòÖ´ÐС£mainÊÇ×îµäÐ͵ĴËÀàÓ¦Óã¬mainµÄ²ÎÊý֮ǰ¶¼±»ºöÂÔµôÁË¡£
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
¡¡¡¡ int count;
¡¡¡¡ printf("The command line has %d arguments:\n", ......