Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need quick help with a small project
#11
Heres some fixed code
Code:
CLS
PRINT "how many students are there?"
INPUT num
DIM student$(num), a(num),b(num),c(num) ,d(num),e(num)
FOR q = 1 TO num
PRINT "enter name"
INPUT student$(q)
PRINT "Enter marks"
INPUT a(q)
INPUT b(q)
INPUT c(q)
INPUT d(q)
INPUT e(q)
NEXT
FOR q = 1 TO num
PRINT student$(q); "'s average is"; (a(q) + b(q) + c(q) + d(q) + e(q)) / 5
IF (a(q) + b(q) + c(q) + d(q) + e(q)) / 5 < 50 THEN
PRINT student$(q); " has Failed"
ELSE
PRINT student$(q); " has Passed"
COLOR 4
PRINT "Congratulations!!"
COLOR 15
END IF
NEXT
Reply
#12
Danno beat me to it, here's mine anyhow:

Code:
CLS
INPUT "How many students are there"; Num
PRINT

DIM Student$(1 TO Num)
DIM Average(1 TO Num)

FOR i = 1 TO Num

  INPUT "Enter name: ", Student$(i)
  PRINT "Enter marks"
  INPUT "1 of 5: ", a
  INPUT "2 of 5: ", b
  INPUT "3 of 5: ", c
  INPUT "4 of 5: ", d
  INPUT "5 of 5: ", e
  PRINT
  Average(i) = (a + b + c + d + e) / 5

NEXT

PRINT
FOR i = 1 TO Num

  PRINT Student$(i); "'s average is"; Average(i)
  IF Average(i) < 50 THEN
    PRINT Student$(i); " has failed. :("
  ELSE
    PRINT Student$(i); " has passed! :D"
    COLOR 15
    PRINT "Congratulations!!"
    COLOR 7
  END IF
  PRINT

NEXT
Reply
#13
lol

i win Big Grin :rotfl: Big Grin
Reply
#14
oh one more thing i have a different program that i'm having trouble with
Code:
CLS
x = 12
y = 40
DO
a$ = INKEY$
LOCATE x, y
PRINT "X"
IF a$ = "w" THEN x = x - 1
IF a$ = "s" THEN x = x + 1
IF a$ = "a" THEN y = y - 1
IF a$ = "d" THEN y = y + 1
LOOP UNTIL a$ = "q"

the code is right but i'm just missing one thing: the X leaves a trail but i want it to clear each time so that it looks like its one x moving around.
Reply
#15
Code:
CLS
x = 12
y = 40
LOCATE x, y
PRINT "X";

DO

  a$ = INKEY$
  IF a$ <> "" THEN
    OldX = x
    OldY = y
    IF a$ = CHR$(0) + "H" THEN x = x - 1
    IF a$ = CHR$(0) + "P" THEN x = x + 1
    IF a$ = CHR$(0) + "K" THEN y = y - 1
    IF a$ = CHR$(0) + "M" THEN y = y + 1
    IF y < 1 THEN y = 1
    IF y > 80 THEN y = 80
    IF x < 1 THEN x = 1
    IF x > 25 THEN x = 25
  
    IF OldX <> x OR OldY <> y THEN
      LOCATE OldX, OldY
      PRINT " ";
      LOCATE x, y
      PRINT "X";
    END IF
  END IF

LOOP UNTIL a$ = CHR$(27)

I made a few "upgrades"...(press ESC to quit)

Btw, your X and Y coordinates are reversed from the usual orientation. Doesn't really make any difference in this case though.
Reply
#16
Code:
CLS
x = 12
y = 40
LOCATE 11, 29: PRINT "Oh dear, I must be going!"

DO
charPrev% = SCREEN(x, y)
LOCATE y, x: PRINT "X"

DO: a$ = INKEY$
IF a$ <> "" THEN EXIT DO
LOOP
LOCATE x, y: PRINT CHR$(charPrev%)

SELECT CASE a$
CASE CHR$(0) + CHR$(72): y = y - 1
CASE CHR$(0) + CHR$(80): y = y + 1
CASE CHR$(0) + CHR$(75): x = x - 1
CASE CHR$(0) + CHR$(77): x = x + 1
CASE CHR$(27): EXIT DO 'escape key
END SELECT
LOOP
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#17
Beat me to it by a minute!

Mine is better!
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#18
lol
thanks guys for helping me
this message board is cool
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)