小さいゲーム--5人の選手に順位をつけて、犯人を探して、銀行のパスワードを模擬して3回シーンを入力して、数字のゲームを当てて、大きいか小さいかを当てて正確に当てるまで

2912 ワード

<pre class="html" name="code"><span style="font-size:18px;color:#ff0000;"><strong><strong><span style="font-size:18px;color:#ff0000;">  :       
</span></strong></strong></span>#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int A = 0, B = 0, C = 0, D = 0, E = 0;
	for (A = 1; A < 6; A++)
	{
		for (B = 1; B < 6; B++)
		{

			for (C = 1; C < 6; C++)
			{
				for (D = 1; D < 6; D++)
				{
					for (E = 1; E < 6; E++)
					{
						if ((((B == 1) + (A == 3)) == 1) && (((B == 2) + (E == 4)) == 1) && (((C == 1) + (D == 2)) == 1) && (((C == 5) + (D == 3)) == 1) && (((E == 4) + (A == 1)) == 1))
						{
							printf("A=%d,B=%d,C=%d,D=%d,E=%d
", A, B, C, D, E); goto flag; } } } } } } flag: getchar(); return 0 ; } <strong><span style="font-size:18px;color:#ff0000;"><strong><span style="font-size:18px;color:#ff0000;"> : </span></strong><span style="font-size:18px;color:#ff0000;"> </span></strong></span>#include<stdio.h> int main() { char killer; int i = 0; for (i = 1; i <= 4; i++) { int sum = 0; killer =64+ i; sum = (killer != 'A') + (killer == 'B') + (killer == 'C') + (killer != 'D'); if (sum == 3) { printf(" :%c
", killer); break; } } getchar(); return 0; }
 
 
<strong><span style="font-size:18px;color:#ff0000;"><strong><span style="font-size:18px;color:#ff0000;">  :         </span></strong>:</span></strong>
#include<stdio.h>
#include<windows.h>
int main()
{
	char pwd[7] = "123456";
	int i = 0;
	for (i = 0; i < 3; i++)
	{
		printf("     :>");
		scanf("%s", pwd);
		if (0==strcmp(pwd,"123456"))
		{
			printf("login success
"); } else { printf(" , !
"); } if (i == 3) { exit(0); } } system("pause"); return 0; }
<span style="color:#ff0000;"><strong><span style="font-size:18px;color:#ff0000;">  :       :</span></strong>
</span>#include<stdio.h>
int main()
{
	int ret;
	int input= 0;
	srand((unsigned)time(NULL));
	ret = rand() % 101;
	while (1)
	{
		printf("    :>");
		scanf("%d", &input);
		if (input > ret)
		{
			printf("   
"); } else if(input < ret) { printf("
"); } else { printf("
"); getchar(); getchar(); break; } } return 0; }