Jubecron Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Jubecron Forum

The JUBECRON forum - Jamaican Chat, Dating, Games, Anime, and just meeting people.
 
HomePortalSearchLatest imagesRegisterLog in

 

 Introduction to Function Call and Parameter Passing in Prolog

Go down 
AuthorMessage
Beezle
Elite Member
Elite Member
Beezle


Female
Number of posts : 547
Age : 34
Mood : Introduction to Function Call and Parameter Passing in Prolog Breezy
Points : 253
Registration date : 2008-03-02

Character sheet
Weapon: Chakrams
Class: Ninja Ninja
HP:
Introduction to Function Call and Parameter Passing in Prolog Left_bar_bleue50/50Introduction to Function Call and Parameter Passing in Prolog Empty_bar_bleue  (50/50)

Introduction to Function Call and Parameter Passing in Prolog Empty
PostSubject: Introduction to Function Call and Parameter Passing in Prolog   Introduction to Function Call and Parameter Passing in Prolog Icon_minitimeTue Oct 19, 2010 7:44 pm

Question:
Send value for salary to a function called comp_net/2. The second value represents the results.


% Author:
% Date: 9/28/2010

calc:-write('Input Salary: '), nl, read(Sal), comp_net(Sal, Net), write('Net: '), write(Net).

comp_net(Sal, Net):-Gct is Sal * 0.15, Net is Sal - Gct.

Question:
Use another function called comp/2 to compare two numbers and output which is smaller.


comp(A, B):-A < B -> write(A) , write(' is smaller'); write(B) , write(' is smaller').
Back to top Go down
Beezle
Elite Member
Elite Member
Beezle


Female
Number of posts : 547
Age : 34
Mood : Introduction to Function Call and Parameter Passing in Prolog Breezy
Points : 253
Registration date : 2008-03-02

Character sheet
Weapon: Chakrams
Class: Ninja Ninja
HP:
Introduction to Function Call and Parameter Passing in Prolog Left_bar_bleue50/50Introduction to Function Call and Parameter Passing in Prolog Empty_bar_bleue  (50/50)

Introduction to Function Call and Parameter Passing in Prolog Empty
PostSubject: Re: Introduction to Function Call and Parameter Passing in Prolog   Introduction to Function Call and Parameter Passing in Prolog Icon_minitimeTue Oct 19, 2010 8:25 pm

The '/2' means that there should be two variables in the header.
Back to top Go down
 
Introduction to Function Call and Parameter Passing in Prolog
Back to top 
Page 1 of 1
 Similar topics
-
» Introduction to If Statements in Prolog
» Prolog Lab 2
» prolog lab 3
» Prolog Exercise 3
» Prolog Lab 1

Permissions in this forum:You cannot reply to topics in this forum
Jubecron Forum :: School :: Schools (General)-
Jump to: