Viết chương trình kiểm tra 1 password là đúng hay sai ( nhập tối đa 3 lần)


Viết chương trình kiểm tra 1 password là đúng hay sai ( nhập tối đa 3 lần)
 #include<stdio.h>
#include<conio.h>
main()
{
int count;
char n[30];
count=0;
// code design by SEO ANH


t:printf("Hay nhap vao Password:");
scanf("%s",n);
count=count+1;

if(strcmp(n,"m24fdn")!=0&& count<3)
{
    printf("Sai pass !!!  Hay nhap lai   ( ban con %d lan nhap tiep)\n",3-count);
    goto t;
}
if((count==3)&&strcmp(n,"m24fdn")!=0)
{
    printf("Qua 3 lan nhap sai.Exit\n");
    exit(1);
}
else printf("Dung pass\n");
getch();

}



Nhãn bài viết: |
Blog, Updated at: 05:51