
-----------------------------------
goroyoshi
Wed Apr 06, 2011 6:27 pm

assigned values are the wrong type
-----------------------------------

var a, b, c, d, e : nat := 0
var choose, times : int
var angle : array 1 .. 5 of nat

put "how many times"

get times

for x : 1 .. times
    randint (choose, 1, 5)
    if choose = 1 then
        a += 1
    elsif choose = 2 then
        b += 1
    elsif choose = 3 then
        c += 1
    elsif choose = 4 then
        d += 1
    elsif choose = 5 then
        e += 1
    end if
end for

angle (1) := (360 / times) * a % these lines glitch
angle (2) := (360 / times) * b + angle (1)
angle (3) := (360 / times) * c + angle (2)
angle (4) := (360 / times) * d + angle (3)
angle (5) := (360 / times) * e + angle (4) %till here

put "a: ", a
put "b: ", b
put "c: ", c
put "d: ", d
put "e: ", e

drawfillarc (maxx div 2, maxy div 2, 100, 100, angle (1), angle (2), 1)
drawfillarc (maxx div 2, maxy div 2, 100, 100, angle (2), angle (3), 2)
drawfillarc (maxx div 2, maxy div 2, 100, 100, angle (3), angle (4), 3)
drawfillarc (maxx div 2, maxy div 2, 100, 100, angle (4), angle (5), 4)
drawfillarc (maxx div 2, maxy div 2, 100, 100, angle (5), 360, 5)


whenever i try to run this it says assigned value is the wrong type to the multipliers of my angles (a, b, c, d, e, angle (1),  angle (2), angle (3), angle (4))

-----------------------------------
Tony
Wed Apr 06, 2011 6:39 pm

RE:assigned values are the wrong type
-----------------------------------
Yes, the expression result and the variable are of different types.

-----------------------------------
goroyoshi
Wed Apr 06, 2011 6:47 pm

RE:assigned values are the wrong type
-----------------------------------
it happens even if both are integers
fixed it with round and real numbers
