Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Password Creation Program

Posted By: Easy Tutor     Category: C Programming     Views: 3582

Password Creation Program

Code for Password Creation Program in C Programming

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<string.h>
#define pixTOrc(x) (8*(x-1))  //convert pixel into row and col format//Advertise Screen will displayed to utilize empty screen area//It can be utilize for some effective...workvoid advertise(){
    setcolor(BLUE);
    outtextxy(pixTOrc(30),pixTOrc(26),"admin@syntaxexample.com");
    setcolor(YELLOW);
}


//Function which shows loading...progress barvoid loading(){
     //progressbar logicint i=1,j,cnt,clrflag=0;
       setcolor(BLACK);
       j=160;
       cnt=5;
       for(i=j;i<420;i++){
          gotoxy(35,25);
          cout<<cnt;
          rectangle(j,375,i,405);
          outtextxy(240,340,"LOADING ");
          if(i==(j+10)){
         j=j+13;
         i=j;
         if(clrflag==1){
           clrflag=0;
           setcolor(BLACK);
         }
         else{
           clrflag=1;
           setcolor(DARKGRAY);
         }
         cnt=cnt+5;
          }
       }
   delay(500);
}



//At Exit the end function will call...void end(){
    setfillstyle(LINE_FILL,DARKGRAY);
    setcolor(YELLOW);
    bar(pixTOrc(2),pixTOrc(10),pixTOrc(80),pixTOrc(55));
    settextstyle(SMALL_FONT,HORIZ_DIR,7);
    outtextxy(pixTOrc(5),pixTOrc(18),"Programmed by : Talented Programmer :))");
    setcolor(LIGHTGREEN);
    outtextxy(pixTOrc(5),pixTOrc(23),"Website : www.syntax-example.com");
    outtextxy(pixTOrc(5.25),pixTOrc(23),"Website : www.syntax-example.com");
    setcolor(LIGHTCYAN);
    outtextxy(pixTOrc(5),pixTOrc(28),"Email : admin@syntaxexample.com");
    outtextxy(pixTOrc(5.25),pixTOrc(28),"Email : admin@syntaxexample.com");
    setcolor(LIGHTMAGENTA);
    outtextxy(pixTOrc(5),pixTOrc(45),"Your Suggestion and comments are always welcome");
    delay(2000);
}



//Function Displaying Password Screen...//I have kept validation that password should not//be greater than 6 letters...u can change it...#define MAX_LETTER 6
int get_password()
{
    setfillstyle(SOLID_FILL,LIGHTGRAY);
    bar(0,0,640,480);
    settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
    setcolor(BLUE);
    outtextxy(pixTOrc(8),pixTOrc(2),"         Validate User");
    setfillstyle(LINE_FILL,BROWN);
    bar(pixTOrc(8),pixTOrc(7),pixTOrc(70),pixTOrc(7.5));

    int i,j;
    setfillstyle(LINE_FILL,DARKGRAY);
    for(i=15,j=65;i<25||j>25;i++,j--){
        bar(pixTOrc(15),pixTOrc(15),pixTOrc(i),pixTOrc(40));
        delay(10);
        bar(pixTOrc(j),pixTOrc(15),pixTOrc(65),pixTOrc(40));
        sound(10+(i*250));
        delay(10);
        nosound();
    }
    int c=pixTOrc(40),a=-1;
    //You can also make use of storing file containing//password...and than encrypt and decrypt for more//secured use...//Another thing...u can make the scree graphics//according to ur taste, i am giving u the most//simple view 4 tasting password.char pass[20],correctpassword[20]="syntax";
    setcolor(YELLOW);
    settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
    outtextxy(pixTOrc(16),pixTOrc(17),"Enter password : ");
    setcolor(LIGHTCYAN);
    outtextxy(pixTOrc(16),pixTOrc(30),"Enjoy the Free version");
    outtextxy(pixTOrc(16),pixTOrc(33),"Password is  syntax");
    setcolor(WHITE);
    while (pass[a]!='\r')
    {
        pass[++a]=getche();
        if  (pass[a]=='\r' || a>=MAX_LETTER){
            pass[a]='\0';
            pass[++a]='\r';
            break;
        }
        c+=15;
        outtextxy(c,pixTOrc(17.5), "*");
     }

        if (strcmp(pass,correctpassword)==0){
            outtextxy(pixTOrc(20),pixTOrc(24),"Password Accepted");
            loading();
            return(0);
        }
        else{
            outtextxy(pixTOrc(20),pixTOrc(24),"Wrong Password!!!");
            setcolor(WHITE);
            getche();
            return (1);
        }
}





void main()
{
    int i,j;

    int gd=DETECT,gm=0;
    initgraph(&gd,&gm,"");


    int incorrect_pass=get_password();

    if(incorrect_pass){
        end();
        goto quit;
    }

    ///Code if password is correct\\\/* Must be written here  *///example
    setfillstyle(SOLID_FILL,BLACK);
    bar(pixTOrc(2),pixTOrc(10),pixTOrc(80),pixTOrc(55));
    settextstyle(SMALL_FONT,HORIZ_DIR,7);
    setcolor(YELLOW);
    outtextxy(pixTOrc(5),pixTOrc(18),"Password is Correct");
    outtextxy(pixTOrc(5.25),pixTOrc(18),"Password is Correct");
    outtextxy(pixTOrc(5),pixTOrc(25),"Programmed by : Talented Programmer");
    outtextxy(pixTOrc(5.25),pixTOrc(25),"Programmed by : Talented Programmer");
    setcolor(LIGHTGREEN);
    outtextxy(pixTOrc(5),pixTOrc(28),"Website : www.syntax-example.com");
    outtextxy(pixTOrc(5.25),pixTOrc(28),"Website : www.syntax-example.com");
    setcolor(LIGHTCYAN);
    outtextxy(pixTOrc(5),pixTOrc(31),"Email : admin@syntaxexample.com");
    outtextxy(pixTOrc(5.25),pixTOrc(31),"Email : admin@syntaxexample.com");
    getch();
    outtextxy(pixTOrc(5),pixTOrc(40),"Have a nice Day");
    outtextxy(pixTOrc(5.25),pixTOrc(40),"Have a nice Day");
    delay(4000);
    /////////////////////////////////

    end();
quit:
    closegraph();

}
  
Share: 


Didn't find what you were looking for? Find more on Password Creation Program Or get search suggestion and latest updates.

Easy Tutor
Easy Tutor author of Password Creation Program is from United States. Easy Tutor says

Hello Friends,

I am Free Lance Tutor, who helped student in completing their homework.

I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.

I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] com

I have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada.

I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.

Thanks,
Happy Programming :)

 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Ashish Kumar from India Comment on: May 12
sir , this program is not run..so plz help me

View All Comments