Demo entry 6657849

bagua

   

Submitted by anonymous on Nov 05, 2017 at 11:02
Language: C++. Code size: 572 Bytes.

#include <iostream>
using namespace std;

int main()
{
	int a, b, c, d,flag;
	//假设A八卦
	a = 1, b = 0, c = 0, d = 0;
	flag = b + d == 1 && b + c == 1 && a + b == 1;
	if (flag) cout << "是A八卦" << endl;
	//假设B八卦
	a = 0, b = 1;
	flag = b + d == 1 && b + c == 1 && a + b == 1;
	if(flag) cout << "是B八卦" << endl;
	//假设C八卦
	b = 0, c = 1;
	flag = b + d == 1 && b + c == 1 && a + b == 1;
	if (flag) cout << "是C八卦" << endl;
	//假设D八卦
	c = 0, d = 1;
	flag = b + d == 1 && b + c == 1 && a + b == 1;
	if (flag) cout << "是D八卦" << endl;
	system("pause");
	return 0;
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).