参数是错误的类型

时间:2013-06-04 14:23:49

标签: variables turing-lang

我试图通过使用 drawarc 和用户输入的值来制作饼图,但在我计算角度后,并尝试绘制弧我得到此错误,“参数是错误的类型“对于item1Angle。任何帮助?

var item1 : int
var item2 : int
var item3 : int
var allItems : int
var item1Angle : real
var item2Angle : real
var item3Angle : real
%Ending Angle for First Sector = starting for second
put "Please Enter The First Item Cost"
get item1

put "Please Enter The Second Item Cost"
get item2

put "Please Enter The Third Item Cost"
get item3

allItems := item1 + item2 + item3

item1Angle := (360/allItems) * item1
item2Angle := (360/allItems) * item2
item3Angle := (360/allItems) * item3

drawfillarc (100,100,50,50, item1Angle, item2Angle)
drawfillarc (100,100,50,50, item2Angle, item3Angle)
drawfillarc (100,100,50,50, item3Angle, item1Angle)

1 个答案:

答案 0 :(得分:0)

想出来,我必须使用 Round 功能,如下所示:

item1Round := round (item1Angle)