Re: QBasic to Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

include get.e --this is used for value() command

integer won, lost, tie, points  -- setup integers
sequence team, buffer  -- setup sequence   !similar to strings!

clear_screen()

puts(1, " TEAM: ")--PRINT "TEAM: ";
buffer = gets(0)-- get a sequence   !similar to a string!
team = buffer[1..length(buffer) - 1]-- put buffer into team without the
linefeed

puts(1, "\n WON: ")--PRINT "WON: ";
buffer = {1}-- set this so loop will start
while buffer[1] = 1 do--loops until valid value for won
  buffer = gets(0)
  buffer = value(buffer)
  if buffer[1] != 1 then
    won = buffer[2]--puts valid value into won
  else
    puts(1, "\n WON: ")
  end if
end while

puts(1, "\n LOST: ")
buffer = {1}
while buffer[1] = 1 do--loops until valid value for lost
  buffer = gets(0)
  buffer = value(buffer)
  if buffer[1] != 1 then
    lost = buffer[2]--puts valid value into lost
  else
    puts(1, "\n LOST: ")
  end if
end while

puts(1, "\n TIES: ")
buffer = {1}
while buffer[1] = 1 do--loops until valid value for lost
  buffer = gets(0)
  buffer = value(buffer)
  if buffer[1] != 1 then
    tie = buffer[2]--puts valid value into tie
  else
    puts(1, "\n TIES: ")
  end if
end while

points = won * 2 + tie    --Compute number of points.
puts(1, "\nTEAM\tWON\tLOST\tTIE\tPOINTS") --Display results.
printf(1, "\n%s\t%d\t%d\t%d\t%d", {team, won, lost, tie, points})

--that should do it       Lucius L. Hilley III

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu