用心给您提供最好的内容,在您的日常生活休闲中,能给您带来一份简单的阅读快乐! - 海洋鸟句子 手机浏览 加入收藏   

海洋鸟句子

当前位置 > 首页 > 经典语录 > 爱情语录 > 

C++代码之爱情篇爱情经典语录

作者:佚名     时间:2010-02-16     浏览:1947    
C++代码之爱情篇爱情经典语录

/*今在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;
else
return 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.感情++;
else
theGirl.感情--;
}
if( 日期转换(day) == theGirl.生日)
{
if( theBoy.赠送礼物(theGirl,玫瑰))
theGirl.感情++;
else
theGirl.感情--;
}
money+=theBoy.拼命赚钱();
}
if(money>1000000)
{
theBoy.有房=true;
theBoy.有车=true;
theGirl.愿意等=false;
break;
}

theBoy.年龄++;
theGirl.感情--;

if(theBoy.年龄>30||the.Girl.感情<0)
theGirl.愿意等=false;
}
if(theBoy.有房==true&&theBoy.有车==true)
theGirl.嫁给(theBoy);
else
{
Boy anotherBoy;
theGirl.恋爱(anotherBoy);
}
}

//注:以上代码尚未编译,请个人自行编译运行,哈哈,祝君顺利

喜 欢

97

上一个:流氓泡妞哲学爱情经典语录
下一个:经典夫妻怄气语录爱情经典语录
 
本站推荐:
一周最热 _ 一周热点的美文文章
网站地图 - 免责声明
Copyright©2024 海洋鸟句子 版权所有 粤ICP备19014702号
本网文章部分来自网络,如有侵犯原作者的利益,请联系我们,我们收到后三天内按照您的要求处理/广告/建议 - Email:2894035371@qq.com
中华人民共和国网络安全法 [2017年6月1日起施行]  -  网络信息内容生态治理规定 [2020年3月1日起施行]