Advertisement
Guest User

Untitled

a guest
Aug 5th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.24 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3.  
  4.  
  5. void splashscreen();
  6. void authentication();
  7. void makeBox(int, int, int, int, int);
  8. void scanPassword(char *, int);
  9.  
  10. void main()
  11. {
  12.     splashscreen();
  13.     authentication();
  14.     getch();
  15. }
  16.  
  17. void splashscreen()
  18. {
  19.     textbackground(BLUE);
  20.     clrscr();
  21.  
  22.     //textcolor(WHITE);
  23.     makeBox(15,6,47,5,4);
  24.  
  25.     textcolor(GREEN);
  26.     gotoxy(18,8);
  27.     cprintf(" B U S   T I C K E T I N G   S Y S T E M ");
  28.  
  29.  
  30.     makeBox(38,22,40,10,3);
  31.     makeBox(42,21,13,2,3);
  32.     textcolor(WHITE);
  33.     gotoxy(43,22);
  34.     cprintf("Information");
  35.     textcolor(WHITE);
  36.     gotoxy(40,25);
  37.     cprintf("Submitted by:");
  38.     gotoxy(40,26);
  39.     cprintf("Submitted to:");
  40.     gotoxy(40,27);
  41.     cprintf("Course: ");
  42.     gotoxy(40,28);
  43.     cprintf("Module: ");
  44.  
  45.     textcolor(YELLOW);
  46.     gotoxy(55,25);
  47.     cprintf("Falano");
  48.     gotoxy(55,26);
  49.     cprintf("Dhiskano");
  50.     gotoxy(55,27);
  51.     cprintf("IDITC");
  52.     gotoxy(55,28);
  53.     cprintf("C Programming (CPG102)");
  54.  
  55.     textcolor(RED+BLINK);
  56.     gotoxy(25,35);
  57.     cprintf("Press any key to continue..");
  58.     textcolor(WHITE);
  59.     _setcursortype(_NOCURSOR);
  60.  
  61.     getch();
  62.  
  63.  
  64. }
  65.  
  66. void authentication()
  67. {
  68.     char username[50], password[50];
  69.  
  70.     textbackground(BLUE);
  71.     clrscr();
  72.  
  73.     makeBox(38,18,25,8,2);
  74.     textcolor(YELLOW);
  75.     gotoxy(40,20);
  76.     cprintf("USERNAME: ");
  77.     gotoxy(40,22);
  78.     cprintf("PASSWORD: ");
  79.  
  80.     _setcursortype(_SOLIDCURSOR);
  81.     gotoxy(52,20);
  82.     scanf("%s",username);
  83.     gotoxy(52,22);
  84.     //scanf("%s",password);
  85.     scanPassword(password,14);
  86.  
  87.     gotoxy(52,40);
  88.     cprintf("Username : %s   Password : %s",username, password);
  89.  
  90.  
  91. }
  92.  
  93.  
  94. void makeBox(int x, int y, int width, int height, int color)
  95. {
  96.  
  97.     int i,j;
  98.  
  99.     textcolor(color);
  100.  
  101.     //top left corner
  102.     gotoxy(x,y);
  103.     cprintf("%c",218);
  104.  
  105.     //top right corner
  106.     gotoxy(x+width, y);
  107.     cprintf("%c",191);
  108.  
  109.     //bottom left corner
  110.     gotoxy(x,y+height);
  111.     cprintf("%c",192);
  112.  
  113.     //bottom right corner
  114.     gotoxy(x+width, y+height);
  115.     cprintf("%c",217);
  116.  
  117.  
  118.  
  119.     for(i=x+1;i<x+width;i++)
  120.     {
  121.         //for top line
  122.         gotoxy(i,y);
  123.         cprintf("%c",196);
  124.  
  125.         //for bottom line
  126.         gotoxy(i,y+height);
  127.         cprintf("%c",196);
  128.     }
  129.  
  130.     for(j=y+1;j<y+height;j++)
  131.     {
  132.         //for left line
  133.         gotoxy(x,j);
  134.         cprintf("%c",179);
  135.  
  136.         //for right line
  137.         gotoxy(x+width,j);
  138.         cprintf("%c",179);
  139.     }
  140. }
  141.  
  142.  
  143. void scanPassword(char *pass, int color)
  144. {
  145.  
  146.     char input[50];
  147.     char in;
  148.     int count=0;
  149.  
  150.     textcolor(color);
  151.  
  152.     do
  153.     {
  154.         in=getch();
  155.  
  156.         if(in==13 && count>0)
  157.         {
  158.             break;
  159.  
  160.         }
  161.         else if(in==8 && count>0)
  162.         {
  163.             printf("%c%c%c",8,32,8);
  164.             count--;
  165.         }
  166.         else if(in==27)
  167.         {
  168.             splashscreen();
  169.         }
  170.         else if(in!=13 && in!=8 && in!=27)
  171.         {
  172.             input[count]=in;
  173.             cprintf("#");
  174.         }
  175.         else
  176.         {
  177.             continue;
  178.         }
  179.         count++;
  180.     }while(count<50);
  181.  
  182.     input[count]='\0';
  183.  
  184.     strcpy(pass,input); //copy the value of input in pointer pass
  185. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement