开发者

Prolog another simple question

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜