Password program
can enter up to three times the correct password, the prompt "login success", the password is wrong, you can re-enter, enter up to three times. Three are wrong, you are prompted to quit the program
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char arr[10] = { 0 };
int i = 0;
for (i = 1; i <= 3; i++) {
printf("请输入密码:");
scanf("%s",arr);
if (strcmp(arr, "623") == 0) {
printf("密码正确");
break;
}
else {
printf("密码错误");
}
if (i == 3) {
printf("密码错误,退出\n");
}
}
system("pause");
return 0;
}