0
Write a program to check whether given username and password entered by user is correct or not.
Write a C program to check whether given username and password entered by user is correct or not, user can check username and password only three times after that program should be terminated. Username: Admin Password: Admin What will be the code for this question? https://code.sololearn.com/cf2cgVZGY78Z/?ref=app
5 Respuestas
+ 9
Bhakti ,
the code for this task should come from you. before we can help you, please do a try by yourself first, put it in playground and link it here. it does not matter if if looks perfect or has some issues, but we can see where you get stuck and give you some useful help.
since you have just started learning c with the tutorial, you should be patient as starting to learn a programming language takes some time and effort from you.
break the requested task in smaller parts and try to solve them step by step.
happy coding and good success!
+ 2
inxanedev! Yeah it will not work becz in c we cannot compare string directly we need to use strcmp for comparing i gave an idea means flow will look like this which i have mentioned
+ 1
Thanks for your advice...
I will try my best👍🏻
+ 1
A.S. does that even work? you can't compare arrays like that, it's not a C++ string. You'd need to use strcmp
0
Take two variables and set your user name and password
Like this
const char user[] ="Admin";
same for password
cont char password[]="1111" ;
Take inputs usernames and passwords then use if condition
like this
If( user=="Admin")&&(password=="Admin")
Print you are able to login
Else
Do what you want