
-----------------------------------
nastynika
Tue Feb 12, 2008 9:57 am

array
-----------------------------------
started a gr 12 comp ssci class but cant remember how to do most of it can u help me with my code please

var marks : array 1 .. 10 of int
var maximum : int := 0
for i : 1 .. 10
    get marks (i)
    cls
    maximum := marks (i)
    put marks (i) ..
end for
put "Maximum = ", Maximum

-----------------------------------
Zampano
Tue Feb 12, 2008 11:23 am

Re: array
-----------------------------------
I guess you want to print the entire array. You don't need the ellipsis points. Of course, if you want to make the aximum the actual highest number, you should check first if it is with an if statement.

-----------------------------------
nastynika
Wed Feb 13, 2008 9:02 am

Re: array
-----------------------------------
so how do i do that i am trying to have ten marks placed on one line after they are entered then have the maximum mark appear underneath

-----------------------------------
Tony
Wed Feb 13, 2008 9:10 am

RE:array
-----------------------------------

if marks(i) > marks(i + 1) then
   put marks(i), " is greater than ", marks(i + 1)
end if


-----------------------------------
nastynika
Wed Feb 13, 2008 9:15 am

Re: array
-----------------------------------
thank you so much Tony

-----------------------------------
Bored
Wed Feb 13, 2008 3:34 pm

Re: array
-----------------------------------
Well if you need to find a maximum you can also use the max command
var a := 8
var b := 54
var maximum : int

put max (10, 25) %Outputs 25
put max (a,b) %outputs 54
put max (b, 100) %outputs 100
maximum := max (86,78)
put maximum %outputs 86

-----------------------------------
nastynika
Thu Feb 14, 2008 9:03 am

Re: array
-----------------------------------
thanx for the help
