Today I’m sharing an interesting money withdrawal game, suppose I picked up a bank card

Withdraw money, enter the password and judge whether it is right or wrong. There are three opportunities in total. Every time you enter it, you will be prompted whether it is right or wrong.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{ int i = 0; char password[20] = {0 }; for (i = 0; i <3 ; i++) { printf("Please enter the password;>"); scanf_s("%s", password, 20); if (strcmp(password, "hellogpp") == 0) { printf("Successful login, balance: 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 \ n "); BREAK; } the else IF (i == 0) printf (" wrong password, rather there are two opportunities to \ n ");












	else if (i == 1)
		printf("密码错误,宁还有一次机会\n");


	else if (i == 2)
		printf("宁已经没有机会了,请到警察局自首\n");
}

system(“pause”);
return 0;
}
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_54748281/article/details/113496651