answersLogoWhite

0


Best Answer

/*:cool: Guys, This program make a file when its run. Run it and Understand it. and tell me, "can i improve in it more?*/

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

{

char user[20],fltp[5]=".txt",flname[25],pswrd[35],cnfrm[35],login[35],pchek[35],c,ps,cn,lg;

int i,j,k,l;

FILE *usr;

clrscr();

gotoxy(25,23);

textcolor(12);

cprintf("Enter Your name:");//Note: this may be works as your username also. Name will be unique.

scanf("%s",&user);//Scanf ko graphical bna. entry control

strcpy(flname,user);

strcat(flname,fltp);

usr=fopen(flname,"r");

if(usr==NULL)

{

usr=fopen(flname,"w");

fprintf(usr,"Username: %s",user);

printf("Welcome!\nYou are a new user\nCreat your password below");

printf("\nEnter Password:");

retry:

j=0;

while((ps=getch())!=13)

{

printf("*");

pswrd[j]=ps;

j++;

}

pswrd[j]='\0';

printf("\nConfirm Password:");

k=0;

while((cn=getch())!=13)

{

printf("*");

cnfrm[k]=cn;

k++;

}

cnfrm[k]='\0';

if((strcmp(pswrd,cnfrm))==0)

{

fprintf(usr,"\nPassword: %s",cnfrm);

fclose(usr);

}

else

{

printf("Password didn't match! Try Again...\n");

printf("Enter password again:");

goto retry;

}

}

else

{ gotoxy(25,25);

cprintf("Password:");

l=0;

while((lg=getch())!=13)

{

printf("*");

login[l]=lg;

l++;

}

login[l]='\0';

i=0;

while((c=getc(usr))!= EOF)

{

if(c=='\n')

{

fseek(usr,10,1);

while((c=getc(usr))!= EOF)

{

pchek[i]=c;

i++;

}

}

}

pchek[i]='\0';

if((strcmp(login,pchek))==0)

{

gotoxy(25,27);

textcolor(11);

cprintf("Welcome Back %s",user);

}

else

{

gotoxy(19,27);

textcolor(11);

cprintf("Wrong Password! You are not authorised");

}

}

getch();

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you Create a password program using turbo C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to you use clear screen in turbo C?

by using "clrscr" command at starting of the program


How do you create a program that can input 100 names using flowchart?

create a program that can input 100 names


How do you create program using characters strings in turbo c?

#include int main (int argc, char **argv){printf ("The name of this program is %s\n", argv[0]);return 0;}There's two character-string in this program, a literal and a variable. Go find them.


Why do you have to create program?

Because I think is possible to predict the lottery using a computer program


To download skype on your iPhone and it ask for a password which you dont have pls help get that password now?

its asking for you itunes password you must create an itunes account on computer using itunes


What is a basic automatic operation of turbo c?

If you are going to program in turbo c (for DOS) you might be better using DJGPP. Google DJGPP for downloading and a whole host of good info.


What has the author Michael Yester written?

Michael Yester has written: 'Using Turbo Pascal 6' -- subject(s): Pascal (Computer program language), Turbo Pascal (Computer file)


Can you create dozens of different VMs by using a virtualization program?

yes


User habits that create security risks?

Like writing your password down on the back of your keyboard or the bottom of your office phone? Or not changing your password? Or using the same password for lots of web sites?


Can you write a C program Without turbo C IDE?

Yes you can write a C program without using turbo C IDE. All you need is a text editor like notepad where you can write your codes and after writting them save the file with .c extension. But for compilling and running the code you will be needing turbo C IDE.


How do you do a username and password login program using C-language?

For a username, just get the username from the standard input using scanf and check whether this username matches with the username stored. If it doesn't match, then the username is wrong.For a password, get each character using getch(). Print a * for each character obtained. Now check this password with the stored password. If these don't match, then the password is wrong.


Program codes in turbo c that will display border on the console screen using for loops?

There is not one that I know off but you could write it.