| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 960 人关注过本帖
标题:作业问题!求给点思路!!谢谢!
只看楼主 加入收藏
andly2013
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-7-11
收藏
得分:0 
谢谢了!另附一下代码。。
#include <iostream>
#include <cstdlib>

using namespace std;

#define NOTAKE 0
#define TAKE 1

#define A (players & 0x01)
#define B ((players & 0x02)>>1)
#define C ((players & 0x04)>>2)
#define D ((players & 0x08)>>3)
#define E ((players & 0x10)>>4)

int players;

void test();
bool check();

int main()
{
    test();
   
    system("pause");
    return 0;
}

void test()
{
    for (players = 0; players < 32; players++)
    {
        if (check())
        {
            if (A == TAKE){cout << "A ";}
        
            if (B == TAKE){cout << "B ";}
        
            if (C == TAKE){cout << "C ";}
        
            if (D == TAKE){cout << "D ";}
   
            if (E == TAKE){cout << "E ";}
            
            cout<<endl;
        }
    }

}

bool check()
{
    bool False = false ;

    if (((A == TAKE)? B == TAKE: true)
        && (B != C)
        && (C == D)
        && (D == TAKE || E == TAKE)
        && (E == TAKE? (A == TAKE && D == TAKE): true))
    {
        return true;
    }
    else
    {
        return False;
    }
   
}

[ 本帖最后由 andly2013 于 2013-7-11 18:52 编辑 ]
2013-07-11 18:46
快速回复:作业问题!求给点思路!!谢谢!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016910 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved