如何编写一个Prolog代码,接受来自用户的CGPA输入并确定该CGPA的级别 [英] how to Write a Prolog code that accepts input of CGPA from user and determines the level of that CGPA

查看:122
本文介绍了如何编写一个Prolog代码,接受来自用户的CGPA输入并确定该CGPA的级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Write a Prolog code
that accepts input of CGPA from user and determines the level

      of that CGPA; > 0 and <

2.00 as "poor", >= 2.00 and < 3.00 as "good" and >= 3.00 as

      "excellent". The example of
output for the Prolog code is as follows:



 ?- run.

Enter your CGPA: 1.60.

Your CGPA is poor.



?- run.

Enter your CGPA: 2.00.

Your CGPA is good.



?- run.

Enter your CGPA: 3.80.

Your CGPA is
excellent.

推荐答案

CGPA; > 0 and <

2.00 as "poor", >= 2.00 and < 3.00 as "good" and >= 3.00 as

      "excellent". The example of
output for the Prolog code is as follows:



 ?- run.

Enter your CGPA: 1.60.

Your CGPA is poor.



?- run.

Enter your CGPA: 2.00.

Your CGPA is good.



?- run.

Enter your CGPA: 3.80.

Your CGPA is
excellent.


这篇关于如何编写一个Prolog代码,接受来自用户的CGPA输入并确定该CGPA的级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆