This is a program I made with C. Check it out.
Code:
#include<stdio.h>
#include<conio.h>
int main()
{
char name[20], passcode[20], option;
int x=0;
codesegment_start:
clrscr();
printf("\n\n\tEnter your name: ");
gets(name);
printf("\n\tEnter the passcode: ");
gets(passcode);
printf("\n\n\n\tPress \"Enter\" to proceed...");
clrscr();
printf("\n\n\n\tPlease wait. Analyzing data...");
while(x < 5)
{
gotoxy(42,4); printf("|");
sleep(1);
x++;
gotoxy(42,4); printf("/");
sleep(1);
x++;
gotoxy(42,4); printf("-");
sleep(1);
x++;
gotoxy(42,4); printf("\\");
sleep(1);
x++;
gotoxy(42,4); printf("|");
sleep(1);
x++;
}
clrscr();
printf("\n\n\n\tYour name is: ");
textcolor(LIGHTBLUE); cprintf("%s", name);
printf("\n\n\t");
textcolor(LIGHTGRAY); cprintf("Verifying passcode");
x=0;
while(x < 7)
{
printf(".");
sleep(1);
x++;
printf(".");
sleep(1);
x++;
printf(".");
sleep(1);
x++;
printf(".");
sleep(1);
x++;
printf(".");
sleep(1);
x++;
printf(".");
sleep(1);
x++;
printf(".");
sleep(1);
x++;
}
pcode:
clrscr();
printf("\n\n\n\tThe passcode that you have entered is: ");
if(!strcmp(passcode, "XMod749"))
{
textcolor(LIGHTBLUE+128); cprintf("ACCEPTED.");
getch();
return 0;
}
else
{
textcolor(LIGHTRED+128); cprintf("INVALID!");
getch();
printf("\n\n\t");
textcolor(LIGHTGRAY); cprintf("What do you want to do?");
printf("\n\n\t\tExit [E] or Retry [R]? ");
option = getche();
option = toupper(option);
switch(option)
{
case 'E':
return 0;
case 'R':
goto codesegment_start;
default:
printf("\n\t\tInvalid command entered. Please try again.");
getch();
goto pcode;
}
}
return 0;
}
..as you can see from the above source-code, the program will ask the user to enter his/her name, then the passcode... The question is, how can I make the program echo asterisks(*) as he/she types in the passcode? Also, is there any way that I can make the sleep() function work in milliseconds? I mean, I want to make it faster, so that when I try to animate something, it won't be so slow... Thanks in advance... -_+