C++µÄÀàÓëCÀïÃæµÄstructµÄÇø±ð
C++µÄÀàÓëCÀïÃæµÄstructµÄÇø±ð
2009-10-11 15:32
¹ØÓÚʹÓôóÀ¨ºÅ³õʼ»¯
classºÍstructÈç¹û¶¨ÒåÁ˹¹Ô캯ÊýµÄ»°£¬¶¼²»ÄÜÓôóÀ¨ºÅ½øÐгõʼ»¯
Èç¹ûûÓж¨Òå¹¹Ô캯Êý£¬struct¿ÉÒÔÓôóÀ¨ºÅ³õʼ»¯¡£
Èç¹ûûÓж¨Òå¹¹Ô캯Êý£¬ÇÒËùÓгÉÔ±±äÁ¿È«ÊÇpublicµÄ»°£¬¿ÉÒÔÓôóÀ¨ºÅ³õʼ»¯¡£
¹ØÓÚĬÈÏ·ÃÎÊȨÏÞ
classÖÐĬÈϵijÉÔ±·ÃÎÊȨÏÞÊÇprivateµÄ£¬¶østructÖÐÔòÊÇpublicµÄ¡£
¹ØÓڼ̳з½Ê½
class¼Ì³ÐĬÈÏÊÇprivate¼Ì³Ð£¬¶østruct¼Ì³ÐĬÈÏÊÇpublic¼Ì³Ð¡£
ΪʲôÔÚC++ÖдæÔÚstruct£¿ºÜ¶àÈ˶¼»áÏëµ½ÕâÊÇΪÁËÈÃC++ºÍC¼æÈÝ£¬ÄÇôÎÊÌâ¾ÍÊÇÈçºÎʹÓÃC++ÖеÄstructºÍC¼æÈÝÆðÀ´¡£
°ÑC++Òª½»»»µ½C³ÌÐòµÄÊý¾ÝÔÚC++³ÌÐòÖÐÉùÃ÷³ÉÒ»¸östruct£¬È»ºó¸ù¾ÝC++ÖгÌÐòµÄÓïÒâÑ¡Ôñ¼Ì³Ð»òÕß¾ÛºÏÕâ¸östruct£¬È»ºóÔÚʹÓõÄʱºò¾Í¿ÉÒÔ°ÑÕâ¸östruct·â×°ÆðÀ´´«µÝµ½CÖлòÕß´ÓCÖд«µÝµ½C++¡££¨×¢£ºÔÚÉîÈë̽Ë÷C++¶ÔÏóÄ£ÐÍÖн¨ÒéʹÓþۺϣ¬¶ø²»ÊǼ̳У¬ÔÒòÊÇΪÁ˺ÍCÓïÑԵĿռä·Ö²¼¼æÈÝ£¬ÒòΪÔÚC++ÒýÈëÐ麯Êý£¬Ðé¼Ì³Ðµ¼ÖÂÁËÅÉÉúÀàµÄ¿Õ¼ä°üÀ¨structµÄ¿Õ¼äºÍvptr¡¢vbtl£¬¶øÇÒvptr¡¢vbtl´æ·ÅÔÚÄÄÀïÓɱàÒëÆ÷×Ô¼º¾ö¶¨£¬C++±ê×¼ÖÐûÓж¨Ò壩¡£
¸ø³öÒ»¸ö´ÓC++µ½CÓïÑÔµÄÒ»¸ö¼òµ¥µÄÀý×Ó£º
//C++Í·ÎļþmoduleA.h
#ifndef MODULE_A_H
#define MODULE_A_H
struct person
{
int age;
char name[20];
};
class male
{
private:
int wife;
struct person per;
public:
int getAge()
{
return per.age;
}
};
extern "C" void print(person );
#endif
//C++µÄʵÏÖÎļþ
#include "moduleA.h"
#include <stdio.h>
void print(person per)
{
printf("age :%d, \n",per.age);
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
typedef ÉùÃ÷£¬¼ò³Æ typedef£¬ÎªÏÖÓÐÀàÐÍ´´½¨Ò»¸öеÄÃû×Ö¡£±ÈÈçÈËÃdz£³£Ê¹Óà typedef À´±àд¸üÃÀ¹ÛºÍ¿É¶ÁµÄ´úÂë¡£ËùνÃÀ¹Û£¬ÒâÖ¸ typedef ÄÜÒþ²Ø±¿×¾µÄÓï·¨¹¹ÔìÒÔ¼°Æ½Ì¨Ïà¹ØµÄÊý¾ÝÀàÐÍ£¬´Ó¶øÔöÇ¿¿ÉÒÆÖ²ÐÔºÍÒÔ¼°Î´À´µÄ¿Éά»¤ÐÔ¡£
µÚÒ»¡¢ËĸöÓÃ;
ÓÃ;һ£º
¶¨ÒåÒ»ÖÖÀàÐ͵ıðÃû£¬¶ø²»Ö»ÊǼòµ¥µÄºêÌæ»»¡£¿ÉÒÔÓÃ×÷ͬʱÉùÃ÷Ö¸ ......
#include<stdio.h>
#include<math.h>
#define u 20
int i,j,n,m;
float Ix[u],I[u][u],H_X,H_Y,H_XY,I_XY,H_XpY,Pypx[u][u],Px[u],H_YpX,Py[u],Pxpy[u][u],Pxy[u][u];
/*¶¨ÒåµÄIx[]=I(x[i])×ÔÐÅÏ¢£»I[][]=I(x[i];y[j])»¥ÐÅÏ¢£»H_X=H(X)ƽ¾ù×ÔÐÅÏ¢£»H_XY=H(XY)ÁªºÏìØ;
I_XY=I(X;Y)ƽ¾ù»¥ÐÅÏ¢£»H_XpY=H(X|Y ......
ÔÚVSÖÐдSQLÓï¾äµÄʱºò£¬Ç§ÍòÍòǧҪСÐÄÔÙСÐÄ£¬±ÈÈç ˵ Êý¾ÝÀàÐ͵ÄÆ¥Å䣬 µ¥ÒýºÅ£¨Õâ¸öÄÜ°ÑÈËÃÔËÀ£©
where ×Ó¾äÖпÉǧÍò²»ÄÜÓпոñ£¨µ±²éѯÌõ¼þΪ×Ö·û´®µÄʱºòÄÜ°ÑÄãŪ·è£¬ÎÒŪÕâ¸öµÄʱºò¶¼·èÁ˼¸´ÎÁË£¬Ê²Ã´¶¼¶Ô¾ÍÊDz鲻³öÀ´£¬µ÷ÊÔÁËN±é²Å·¢ÏÖ¡££©²»ÐÐÁË£¬³Ô·¹È¥£¬ÔÙ²»³Ô¿´¼û»îÈ˶¼ÏëÒ§ÁË¡£ ......
ÎÒÕâÁ½ÌìÔÚCSDNÂÛ̳¿ªÁËÒ»¸öÉ¢·ÖÌù£¬ÏëÐû´«Ò»ÏÂÎÒµÄÊé¡£´ó¶àÊýÅóÓÑ»¹ÊǺÜÓѺõģ¬¶ÔÎÒµÄÖ§³ÖºÍ¹ÄÀøºÜ¶à£¬ÎÒÒ²ºÜ¸Ð¼¤¡£
ÍøÖ·ÔÚÕâÀhttp://topic.csdn.net/u/20091216/22/5a6594be-21e6-459e-ab41-57755273f465.html
µ±È»£¬Ò²ÓÐÅóÓÑÈÏΪФijÈË´µÅ££¬Ëµ0bug²»¿ÉÄÜ£¬²¢ÇÒÒþÒþÓÐPKµÄÒâ˼£¬ÎÒÄØû°ì·¨£¬Ð´Á˸ö˵Ã÷¡£
ÕâÀïÏëÁ ......