开发者

Prolog another simple question

开发者 https://www.devze.com 2022-12-22 19:39 出处:网络
How do i read in char type by user开发者_如何转开发s if they are a- , b+ , o+ ? I don\'t seem to have problem reading in char like a , b , c or d. i am using read(X) . Can someone help me out with thi

How do i read in char type by user开发者_如何转开发s if they are a- , b+ , o+ ? I don't seem to have problem reading in char like a , b , c or d. i am using read(X) . Can someone help me out with this ? Thanks in advance.


I managed to solve the problem using read_string() . :)


As I remember read/1 reads the term. If you want to read characters you may consider get_char/1 or something like that

?- get_char(X),get_char(Y).
|: a-

X = a,
Y = (-).
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号