/*今在VC论坛上看到一段好代码叫C语言代码人生之恋情篇,各大虾正在热闹探讨,当初哦把它简略地标准C++代码,作为抛砖引玉,供各位大虾持续施展,写成人生篇,事业篇什么的应当不难,最好写成了一段完全尺度的C++语语言法教材*/#include#include#include
一些必要头文件
#define
NOTHING
不需任何货色
class
Boy{public:bool
有房;bool
有车;int
年纪;public:Boy();~Boy();void
恋爱(Girl
girl);void
具备条件(char
*another);bool
赠送礼物(Girl
girl,char
*gift)long
拼命赚钱();};
class
Girl{public:int
情感;bool
违心等;int
诞辰;public:Girl();~Girl();void
恋爱(Boy
boy);void
嫁给(Boy
boy);};
Boy::Boy(){int
i;i=rand();if(i=100){有房=true;}else{有房=false;}i=rand();if(i=200){有车=true;}else{有车=false;}}
Boy::~Boy(){
}
void
Boy::恋爱(Girl
girl){与girl进入相恋阶段;}
void
Boy::其他具备条件(char
*another){Boy目前领有的除屋子车子外条件=another;}
bool
Boy::赠送礼物(Girl
girl,char
*gift){
if(Boy将礼物送给girl)return
true;elsereturn
false;}
long
Boy::拼命赚钱(){Boy昼夜操劳,两眼发黑,为的是月末能拿到那可怜的钞票;return
一年挣下的钞票总数;}
Girl::Girl(){
}
Girl::~Girl(){}
void
Girl::恋爱(Boy
boy){与boy进入相恋阶段;}
void
Girl::嫁给(Boy
boy){批准嫁给boy,与boy步入神圣的婚姻殿堂;}
void
main(
){
Boy
theBoy;Girl
theGirl;int
year;long
money;
theBoy.春秋=25;theBoy.恋爱(theGirl);year=1;theGirl.感情=1;theGirl.愿意等=true;theGirl.生日=1001;money=0;
if(
theBoy.有房==true&&theBoy.有车==true){theBoy.其余具备前提(NOTHING);theGirl.嫁给(theBoy);return;}while
(theGirl.乐意等==true){
for(
int
day=1;
day<=365;
day++){if(
节日转换(day)
==
情人节){if(
theBoy.赠送礼物(theGirl,玫瑰))theGirl.感情++;elsetheGirl.感情--;}if(
日期转换(day)
==
theGirl.生日){if(
theBoy.赠予礼物(theGirl,玫瑰))theGirl.感情++;elsetheGirl.感情--;}money+=theBoy.拼命赚钱();}if(money>1000000){theBoy.有房=true;theBoy.有车=true;theGirl.乐意等=false;break;}
theBoy.年龄++;theGirl.感情--;
if(theBoy.年龄>30the.Girl.感情<0)theGirl.愿意等=false;}if(theBoy.有房==true&&theBoy.有车==true)theGirl.嫁给(theBoy);else{Boy
anotherBoy;theGirl.恋爱(anotherBoy);}}
//注:以上代码尚未编译,请个人自行编译运行,哈哈,祝君顺利
本文来自:逍遥右脑记忆 /yulu/99792.html
相关阅读:精彩爱情语录:恋爱本不是慈善事业
我厌恶的不是爱情,而是等待
昨日的泪水,激起心中的涟漪
40条的一句话唯美爱情语录
情人节爱情语录 情人节我会让你更幸福