Advertisement
Guest User

logintest

a guest
Aug 27th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include <stdio.h> //para sa printf
  2. #include <conio.h> //para sa getch
  3. #include <string.h> //Eto yung para sa strcmpna function di gagana yun kung wala to
  4. void main()
  5. {
  6.     char pw[]="Hello";  //Eto yung password na iinitialize
  7.     char temp[20];  //temporary character  array (or string )
  8.     printf("Input Password:"); //prompt for password
  9.     scanf("%s",&temp); // %s= string input  tapos ilalagay yung value na yun sa temp
  10.     if(strcmp(temp,pw)==0)  //yung ginagawa ng strcmp magrereturn ng 0 kung yung 2 string magkapareho
  11.     {
  12.     printf("Login Successful!"); //kung magkapareho yung tinype mo (temp) dun sa password (pw) magpapakita to
  13.     getch(); //para di magclose yung program agad
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement