/*今在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條的一句話唯美愛情語錄
情人節愛情語錄 情人節我會讓你更幸福