#include <iostream> #include <string> #include <cstdio> #include <cstdlib> #include <adodb.h> // CRecordset is defined here. typedef int 成熟度; #define RANDOM( max ) ( (int)(max*rand()/RAND_MAX) ) class CPerson { public: int 年齡,人脈,意志; bool 戀愛,懷孕; long long 金錢; 成熟度 技術; CRecordset 履歷表; string 性別; CPerson 配偶,父,母,女友; public: CPerson() {} }; bool is家有錢( CPerson& p ) { if( (person.父.金錢+person.母.金錢)>10000000 ) return true; else return false; } bool is墮胎( CPerson& p ) { // 不可預期 randomize(); return RANDOM( 1 ); } bool is鬧很大( CPerson& p ) { // 不可預期 randomize(); return RANDOM( 1 ); } bool can結婚() { //有鑒於目前社會的一些現況, //調整最低年齡為15,最高年齡為無 if( person.年齡 > 15 ) if( has適當對象() && person.戀愛==true ) return true; return false; } int 結婚() { // nothing special } bool isEnough( CPerson& p ) { if( p.戀愛==true ) { if( p.女友.懷孕==true && is墮胎(p.女友)==false && is鬧很大()==true ) { if( can結婚() ) 結婚(); return true; } } if( is家有錢()==false ) return true; if( 意志==0 ) return true; return false; } int 求學() { // nothing special } int 服役() { // nothing special } int 上班() { if( 實力不足() ) 培養實力(); else { if( 薪水 < 能力 && 有更好的機會()==true ) 跳槽(); else if( 薪水 >= 能力 ) //滿意 NULL; // do nothing else if( 薪水 < 能力 && 有更好的機會()==false ) 認命(); } if( 錢 > (錢 + 之前的錢) && 閒 = true ) 度假休息(); if( can結婚()==true ) 結婚(); if( has機會() ) 創業(); else 作哈巴狗(); } int main() { CPerson person=人_出生(); if( is家有錢( person ) ) exit( EXIT_FAILURE ); else { while( isEnough( person )==false ) 求學(); if( person.sex==string("男") ) 服役(); while( isDead( person )==false ) 上班(); } // The person is dead, // C++ will release person automatically. }