/*
*Copyright(c)2014,烟台大学计算机与控制工程学院
*Allrights reserved.
*文件名称:test.cpp
*作者:肖雪
*完成日期:2016年3月29日
*版本号:v1.0
*
*问题描述:谁是小偷
*/
#include <iostream>
using namespace std;
int main()
{
int a,b,c,d;
for(a = 0; a <=1; ++a)
for(b = 0;b <=1; ++b)
for(c = 0; c <=1; ++c)
for(d = 0; d <=1; ++d)
if(((a==0)+(c==1)+(d==1)+(d==0) == 3) && a+b+c+d == 1)
{
if(a == 1)
cout << "A是小偷"<<endl;
if(b == 1)
cout << "B是小偷"<<endl;
if(c == 1)
cout << "C是小偷"<<endl;
if(d == 1)
cout << "D是小偷"<<endl;
}
return 0;
}
第三周 项目4(6)谁是小偷
最新推荐文章于 2017-11-03 14:37:34 发布