Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The Database of scores!
#1
A friend and I wanted to make a program in QBasic to save our top scores in games such as asteroids.

We wanted to make it like this
-----------------------------
List of games

1) Asteroids
2) Plaque Attack
3) Donkey Kong

with either a preset list or a list we can enter.

and you press the number of the game you want, and it brings up all the scores that we previously put in

so if you press 1 it would say
-----------------------
Asteroids

Edd - 29,000
Justin - 31,000
etc...
-----------------------
I know basic programming but no idea how to do that, can anyone help?
Reply
#2
DO you mean you read the scores from another file?
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#3
This is just off the top of my head, so if it doesn't work, sue me.

Code:
Menue:
PRINT "1) View High Scores"
PRINT "2) Add a score"
PRINT "3) Quit"
INPUT "Your selection: ", s
IF s > 2 then end

if s = 1 then
cls
print "1) Asteriods"
print "2) Donkey Kong"
print "3) Whatever"
input "Your choice: ", c
select case c
    case 1: fname$ = "Asteroids.dat"
    case 2: fname$ = "Dk.dat"
    case 3: fname$ = "whatever.dat"
end select
open fname$ for input as #1
print "Name", "Score"
do
  input #1, who$
  input #1, score
  print who$, score
loop until eof(1)
end if

if s = 2 then
cls
print "1) Asteriods"
print "2) Donkey Kong"
print "3) Whatever"
input "Your choice: ", c
select case c
    case 1: fname$ = "Asteroids.dat"
    case 2: fname$ = "Dk.dat"
    case 3: fname$ = "whatever.dat"
end select
open fname$ for append as #1
input "Who's score? ", name$
input "Score: ", score
print #1, name$, score
close
end if

goto menue

This doesn't put the scores in order or anything; you'll have to use a bubble sort or something for that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)