网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
04月24日漏签0天
计算机吧 关注:374,929贴子:1,192,030
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 0回复贴,共1页
<<返回计算机吧
>0< 加载中...

C++爱情程序

  • 只看楼主
  • 收藏

  • 回复
  • 乱世——枭雄
  • 默默无闻
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#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);
}
}



登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 0回复贴,共1页
<<返回计算机吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示