模拟三次密码输入

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

#include<windows.h>

int main()

{

int n = 1;

char pwd[10];

while (1)

{

printf("put the passwd:");

scanf("%s", pwd);

if (strcmp(pwd, "123456") == 0)

break;

if (n<3)

{

printf("please try again\n");

n++;

}

else

{

printf("see you\n");

return -1;

}

}

printf("welcome to bit!");

system("pause");

return 0;


你可能感兴趣的:(C语言小程序)