How can I create a login system in C?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

You can download the videos from Youtube
Comments

main() { int i,counter=0,flag=0; char uid,pwd,s_uid={"11user1","12user2","13user3"}; char s_pwd={"Pwd1","Pwd2","Pwd3"},ch='a';/*dummy character in ch */ clrscr(); printf("\n Enter the user id : "); scanf("%s",uid); printf("\n Enter the password : "); i=0; while(1) { ch=getch(); if(ch==13) break; else...
read more
main() { int i,counter=0,flag=0; char uid[25],pwd[25],s_uid[][25]={"11user1","12user2","13user3"}; char s_pwd[][25]={"Pwd1","Pwd2","Pwd3"},ch='a';/*dummy character in ch */ clrscr(); printf("\n Enter the user id : "); scanf("%s",uid); printf("\n Enter the password : "); i=0; while(1) { ch=getch(); if(ch==13) break; else if(ch==8) { if(i!=0) /*this is for avoiding the ENTER instructions getting deleted */ { printf("\b"); /*printing backspace to move cursor 1 pos back*/ printf("%c",32);/*making the char invisible which is already on console*/ printf("\b"); /*printing backspace to move cursor 1 pos back*/ i--; pwd[i]='\0'; } else continue; } else { putchar('*');/* char - '*' will be printed instead of the character */ pwd[i]=ch; i++; } } pwd[i]='\0'; for(i=0;i<=2;i++) { if((stricmp(uid,s_uid[i]))==0 && (strcmp(pwd,s_pwd[i]))==0) { flag=1; break; } } if(flag) printf(" \n \n \t \t USER AUTHENTICATED "); else printf("\n \n \n\t TRESSPASSERS WILL BE SHOT AND SURVIVORS WILL BE SHOT AGAIN .. ha ha :)"); printf("written by dileep basam .. [snipped email]"); getch(); } read less
Comments

Related Questions

When is a "switch" statement better than multiple "if" statements?
switch statement is generally best to use when you have more than two conditional expressions based on a single variable of numeric type. For instance, rather than the code if (x == 1) printf(“x...
Shalu
What are pointers in C language?
a variable that stores the memory address of another variable
Sanjeevani
0 0
6
What is the fee for learning C Language?
In C lang course ,there is not only basics it also having whole package to complete the task and course.cost may be it's depends upon the institute n teaching level
Sk.
What is meant by "bit masking"?
For example if you want to know if third bit is 1 or not for an int x then you can mask all other bits and just check the third one: (n & 0x04) != 0 means 3rd bit is not zero, 0x04 is the bit mask
Kiran
0 0
6
what is syntex error
A syntax error is an error which found in the source code of a program or sometimes it can be small grammatical mistakes in spelling or limited to a single character. Programming languages follow their...
Tanha

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

C Program-Error Handling
//Header files #include<stdio.h>#include<conio.h>#include<stdlib.h> //Main function void main(){ int dividend=10; int divisor=0; int quotient; //Function for clearing screen clrscr(); ...


Program to swap the value of two variables without using third variable(simplest way)...
int main() { int a=10,b=20; printf("values of a before swap ="%d,a); printf("values of b before swap ="%d,b); a=a+b; b=a-b; a=a-b; printf("******************"); printf("values of a after swap...

All About Programming And A Good Programmer.
Hi, This is my first lesson for you guys. Hope you enjoy reading it. In recent community questions, I found many people wanted to be good programmers, or wanted to have good hands on certain language,...

Set 0 To Kth Bit In A Variable
The following code snippet Set 0 to Kth Bit in an variable #include int UnsetBitValue(int n, int k);int main(){ printf("%d\n\n",UnsetBitValue(255,6)); return 0;}// Set kth bit to zeroint UnsetBitValue(int...

Recommended Articles

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you