
-----------------------------------
koolkid98
Wed May 10, 2006 8:36 am

Help with determining score for a user.
-----------------------------------
Hey........ i have this program i am doing for school, either i pass this task or i fail ok....  i made a program but it doesnt work can you guys please tell me whats wrong with it? Also i was wondering how you can make a point system to this program where every time someone answers the question right they are rewarded with one point and if they answer it wrong they get -1 point..... help me please 

var music : string
var point : int
var song : string
point:= 0
put "This is a two players Trivia game followed by a point system, person who answers the most questions correctly wins."
put "What song is currently playing ?"
get song
if song := Bitter Sweet Sympthony then
  put "correct, you have", point+1, "Points" 
end if


thnks, Jim

-----------------------------------
Bobrobyn
Wed May 10, 2006 9:00 am

Re: Hey i need help desperatly on this program
-----------------------------------
I think the main problem is the lack of quotes around the Bitter Sweet Sympthony.  It SHOULD look like this:


if song := "Bitter Sweet Sympthony" then %This is a string, it needs quotes for   % comparisons
     put "correct, you have", point+1, "Points" 
end if


For the point system, you need to ADD a point if the user is correct, otherwise you need to SUBTRACT a point -- Also, in class, you NEVER EVER do calculations in put statements.  You lose marks.


var music : string
var point : int
var song : string
point:= 0
put "This is a two players Trivia game followed by a point system, person who answers the most questions correctly wins."
put "What song is currently playing ?"
get song
if song := "Bitter Sweet Sympthony" then 
     point := point + 1
     put "correct, you have ", point, " Points" 
else
     point := point - 1
     put "Wrong, you have ", point, " points"
end if


Another suggestion - format your code properly!  Another small tidbit - for something like this, you could have it set up like a multiple choice test.  That way, if a person doesn't know the spelling, they can still answer.

-----------------------------------
Remm
Wed May 10, 2006 9:05 am


-----------------------------------
First of all, your going to need to change the
get song
to
get song:*
or it will only register the first word.
Also, you will need two variables to hold the two players
points, and instead of having 'points + 1' in your sentance, you'll need
to have it just put into a variable
e.i.
p1points := p1points + 1
have somthing also to tell which player is imputing data, so it knows who to give the point to. A good place to look is the turing walkthrough for further referance.
Good luck
Remm[/code]

-----------------------------------
codemage
Wed May 10, 2006 1:23 pm


-----------------------------------
For someone who only has 9 bits, you've already very much on the ball, Remm.

-----------------------------------
Clayton
Wed May 10, 2006 3:22 pm


-----------------------------------
also in your code

if song:= whatever
end if

doesnt work, it has to be

if song=whatever then
end if

