I want to code this program like,when user enter the password wrong 3 times user will see that ("your account has been blocked f | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to code this program like,when user enter the password wrong 3 times user will see that ("your account has been blocked f

#include<stdio.h> //ı couldnt do it please help #include<string.h> int main() { char user[100]; char psw[100]; char ruser[100]="getmedown"; char rpsw[100]="well ok"; int count=0; again: printf("\nEnter your ID and password.\n"); gets(user); gets(psw); if(strcmp(user,ruser)==0 && strcmp(psw,rpsw)==0) { printf("Welcome to your account"); } else{ printf("wrong inputs.."); goto again; count++; if(count==3){ printf("your account has been blocked for 5 min"); } } return 0; }

3rd May 2020, 11:08 PM
Abc def
Abc def - avatar
1 Answer
+ 1
use a loop and a count(variable) to the number of times input failed, then when count get to 3 you terminate and give the account blocked message
3rd May 2020, 11:28 PM
✳AsterisK✳
✳AsterisK✳ - avatar