
-----------------------------------
Crazya
Wed Jun 06, 2007 11:12 am

i request assistance with this grid
-----------------------------------
function CreateHorizontalV2 : array 1 .. 5 of int % (no parameters needed)
    var X : array 1 .. 5 of int
    var found : boolean
    X (1) := Rand.Int (2, 9) % pick any random for the first one

    for i : 2 .. 5
        loop
            X (i) := Rand.Int (2, 9) % pick a random number
            found := false % assume it hasn't been used before
            for j : 1 .. i - 1 % check all previous numbers to see if a duplicate exists
                if X (i) = X (j) then
                    found := true % bad - must try a new random
                    exit
                end if
            end for
            exit when found = false
        end loop
    end for
    result X
end CreateHorizontalV2

function CreateVerticalV2 : array 1 .. 5 of int % (no parameters needed)
    var X : array 1 .. 5 of int
    var found : boolean
    X (1) := Rand.Int (2, 9) % pick any random for the first one

    for i : 2 .. 5
        loop
            X (i) := Rand.Int (2, 9) % pick a random number
            found := false % assume it hasn't been used before
            for j : 1 .. i - 1 % check all previous numbers to see if a duplicate exists
                if X (i) = X (j) then
                    found := true % bad - must try a new random
                    exit
                end if
            end for
            exit when found = false
        end loop
    end for
    result X
end CreateVerticalV2

function answer (vertical : array 1 .. 5 of int, horizontal : array 1 .. 5 of int) : array 1 .. 5, 1 .. 5 of int
    var x : array 1 .. 5, 1 .. 5 of int
    for i : 1 .. 5
        for j : 1 .. 5
            x (i, j) := vertical (i) * horizontal (j)
        end for
    end for
    result x
end answer

% MAIN
var hN : array 1 .. 5 of int
hN := CreateHorizontalV2
put "  " ..
for i : 1 .. 5
    put hN (i) : 3 ..
end for
put ""

var vN : array 1 .. 5 of int
vN := CreateVerticalV2
for i : 1 .. 5
    put vN (i) : 3
end for
put ""
% out puts the answers to the grid above
var ans : array 1 .. 5, 1 .. 5 of int
ans := answer (vN, hN)
for i : 1 .. 5
    for j : 1 .. 5
        put ans (i, j) : 3 ..
    end for
    put ""
end for


I need to be able to take in an input for a random selected number combo,   example   the grid is like this   1 2 3 4 5
                                                                                                                                                          1 
                                                                                                                                                          2 
                                                                                                                                                          3
                                                                                                                                                          4
                                                                                                                                                          5
  it should select a random math equation to do  ex, 3*4 and if you put in 24  it should say wrong and if you put in 12 it should say correct.

could any one aid in my quest for this program
if need to b explained better just comment saying say again

-----------------------------------
Mazer
Wed Jun 06, 2007 1:17 pm

RE:i request assistance with this grid
-----------------------------------
I request you learn to post in the right section. And read the guidelines for how to post (eg, use code tags).

This isn't your first day here.
