/*: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();
}
by using "clrscr" command at starting of the program
create a program that can input 100 names
#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.
Because I think is possible to predict the lottery using a computer program
its asking for you itunes password you must create an itunes account on computer using itunes
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.
Michael Yester has written: 'Using Turbo Pascal 6' -- subject(s): Pascal (Computer program language), Turbo Pascal (Computer file)
yes
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?
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.
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.
There is not one that I know off but you could write it.