当前位置:网站首页>Log in with password and exit with error for three times.

Log in with password and exit with error for three times.

2022-06-11 20:28:00 csdn_ one thousand nine hundred and ninety-seven

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <windows.h>
#include <string.h>


int main()
{
    int mm[20] = { 0 };
	int i = 0;
	
	for (int i = 0; i < 3; i++)
	{   
		printf(" Please input a password :");
		scanf("%s", mm);
		if (strcmp(mm, "123456") == 0)
		{
			printf(" Landing successful !!");
			break ;
		}
		else
		{
			printf(" Wrong password , Please re-enter \n");
		}
	}

	if (i == 3)
	{
		printf(" Three mistakes , Log out .");
	};
	
    return 0;
}

原网站

版权声明
本文为[csdn_ one thousand nine hundred and ninety-seven]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203011747008179.html