SWI Prolog , how to assert data to txt file -
This is my sample source code, I am using SWI Prolog, can someone tell me how to data To be implemented in which the user's key txt.file I want to save the data in txt.file.
Start: -display_menu
Write ('\ n1. User Information Enter'), type ('\ n0.exits'), enter ('\ n enter your choice:'), read (choice), selection (choice), choice = 0
Selection (1): - get_userinfo.
Selection (0): -!
get_userinfo: -write ('\ n * enter user information '), get_attribute: - type ('enter height \'), Age (age): - Age & lt; 18, write ('enter valid age.'). check; You probably want to open / close 3 and close / use one file to open / close and write / 2. Like:
('\ nEnter the name:' Write (name), write ('\' gender: ''), read (gender), write ('\' enter age: '), read (age), no (age group) ('\ NGet properties'), get_attribute (attr), emphasis (userInfo (name, gender, age, aTTR)).
read (height), attr = [height].
open ('myfile.txt)', write, s), write (s, data), stop (s).
Comments
Post a Comment