Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

Prolog program of login page

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 5023

Prolog program of login page.

Code for Prolog program of login page in Artificial Intelligence

domains
    person , password = symbol
predicates
    password_of(person,password)
    login
    count(integer)
    message(integer)
    
clauses
    password_of(Hetal,He).
    password_of(Prashant,pr).
    
    login :-
        makewindow(1,10,2,"Login",0,0,20,50),
        write("Welcome!   Please Login"),nl,
        count(3),
        write("Login Unsuccessful"),nl.
        
    login :-
        write("Login Successful"),nl.
        
    count(X) :-
        X <> 0,
        write("UserName :- "),
        readln(Username),
        write("Password :- "),
        readln(Password),
        not(password_of(Username,Password)),
        Y = X - 1,
        clearwindow,
        message(Y),
        count(Y).
    count(0).        
    
    message(X) :-
        X <> 0,
        write("Login Failed\nPlease Try Again!\n").
        
    message(0).
        
Goal
    login.


Output :    

Trial 1 :
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄLoginÄÄÄÄÄÄÄ
³Welcome!   Please Login
³UserName :- Hetal
³Password :- He
³


ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄLoginÄÄÄÄÄÄÄÄÄÄÄÄ
³Login Failed
³Please Try Again!
³UserName :-
³

Final Trial :

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄLoginÄÄÄÄ
³Welcome!   Please Login
³UserName :- Prashant
³Password :- pr
³Login Successful
³
³Press the SPACE bar

  
Share: 


Didn't find what you were looking for? Find more on Prolog program of login page Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of Prolog program of login page is from India.
 
View All Articles

 
Please enter your Comment

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

 
Aadil Khan from United States Comment on: Apr 30
dude have a problem wht if i want to to keep the login window after the successful of the login attemp to show tht msg " logged succesfully " then if the user click or enter thn tht window should go to goal are again ?

View All Comments