1. This module works now.

Bonn and Pete,

I have the following code.  I fixed the problem and instated my real
purpose.  This module works as intended.

include input.e
clear_screen()
sequence prompt
atom i
prompt =3D {97,98,99,100,101,102,103,104,105,106,107,108}
for prompt_loop =3D 1 to 12 do
i =3D input("Enter " & prompt[prompt_loop] & ": ")
puts(1,"\n")
end for

--Alan
 =

new topic     » topic index » view message » categorize

2. Re: This module works now.

At 07:40 PM 5/27/98 -0400, you wrote:

>include input.e
>clear_screen()
>sequence prompt
>atom i
>prompt = {97,98,99,100,101,102,103,104,105,106,107,108}
>for prompt_loop = 1 to 12 do
>i = input("Enter " & prompt[prompt_loop] & ": ")
>puts(1,"\n")
>end for
>
>--Alan

Have you considered:

for prompt_loop=97 to 108 do
    i=input("Enter "&prompt_loop&": ")
    puts(1,"\n")
end for


Storing consecutive numbers in a sequence
isn't really nesessary.

Graeme.
----------------------------------------------------

new topic     » goto parent     » topic index » view message » categorize

3. Re: This module works now.

Dear Graeme,

Your code from the last reply is so much cleaner.  I'll make some changes=
=2E

--Alan
 =

new topic     » goto parent     » topic index » view message » categorize

4. Re: This module works now.

Here's my version: Hope there are no typos
(those formulas boggle the eyes)

-----33matrix.ex-----

include input.e
constant prompt = "abcdefghijkl"

sequence v, sav
         v = repeat(0,12)

atom a,b,c,d,e,f,g,h,i,j,k,l,
     M,N,O,P

clear_screen()
for x = 1 to length(prompt) do
  v[x] = input("Enter a value for " & prompt[x] & " \n")
end for

sav = v -- save the numbers for use later:
-- convert to atoms so your formulas will still work:
a = v[1] b = v[2] c = v[3] d = v[4]  e = v[5]  f = v[6]
g = v[7] h = v[8] i = v[9] j = v[10] k = v[11] l = v[12]

M = a*e*i-a*f*h+b*f*g-b*d*i+c*d*h-c*e*g
    a = j
    d = k
    g = l

N = a*e*i-a*f*h+b*f*g-b*d*i+c*d*h-c*e*g
    a = sav[1]
    d = sav[4]
    g = sav[7]
    b = j
    e = k
    h = l

O = a*e*i-a*f*h+b*f*g-b*d*i+c*d*h-c*e*g
    b = sav[8]
    e = sav[5]
    h = sav[8]
    c = j
    f = k
    i = l

P = a*e*i-a*f*h+b*f*g-b*d*i+c*d*h-c*e*g

printf(1,"Your answers are: %f %f %f", { N/M, O/M, P/M })

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu