Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Trivia Game
Author Message
Mathwiz

Posted: Wed Nov 01, 2006 9:45 am   Post subject: Trivia Game

colorback (40)
drawfill (0, 0, 40, 40)
process Weird
loop
Music.Sound (270, 200)
Music.Sound (270, 100)
Music.Sound (270, 100)
Music.Sound (270, 250)
Music.Sound (270, 200)
Music.Sound (335, 200)
Music.Sound (270, 200)
Music.Sound (335, 200)
Music.Sound (270, 200)
Music.Sound (335, 200)
Music.Sound (335, 100)
Music.Sound (335, 100)
Music.Sound (335, 200)
Music.Sound (335, 200)
Music.Sound (400, 200)
Music.Sound (335, 200)
Music.Sound (400, 200)
Music.Sound (335, 200)

end loop
end Weird
fork Weird
put "**********************"
put " Mathew's Trivia Game"
put "**********************"
var name : string
var number : real := 0
var x, y : int
var key : string (1)
var total : real := 0
var letter : string

% The following will ask you what our first and last name
get name : *
put " Hit any key to countine"
getch (key)
cls
put " Hello ", name, " please Answer as many of the following Questions"
put " Would you like to continue Y/N?"
get letter
put " Hit any key to countine"
getch (key)
cls
% Question you will be asked and the Answers and it will tell you if you are right
% or wrong if you are wrong it will tell you the right answer
put " question 1"
put " What are the ingredience in Concrete?"
put "1. rock, powder, water"
put "2. rock, pizza, water, soda"
put "3. rocl, salt, gunk"
get number
if number = 1 then
put " you are correct"
total := total + 1
end if

if number > 1 then
put " you are wrong"
put " the correct answer is 1"
end if
colorback (40)

put " Hit any key to countine"
getch (key)
cls

put " Question 2"

put "Why do you have to keep the concete wet if you are not using it?"
put "1. because it will disinagrate."
put "2. because it will dry out."
put "3. because you arenot using it"
put "4. because your going to use it sooner or later"
get number

if number < 2 then
put " that is wrong"
put " the corrects answer is 2"
end if
if number = 2 then
put " you are correct"
total := total + 1
end if
colorback (40)
if number > 2 then
put " you are wrong"
put " that correct answer is 2"
end if
put " Hit any key to countine"
getch (key)
cls
colorback (40)
put " Question 3"
put " how many different types of concrete if there?"

put "1. 1"
put "2.4"
put "3.6"
put "4.2"
get number
colorback (40)
if number = 4 then
put " that is correct"
total := total + 1
end if
if number < 4 then
put " that is wrong"
put " the correct answer is 4"
end if
put " Hit any key to countine"
getch (key)
cls
colorback (40)

put " Question 4"
put " when you level the concrete you have to________ "
put " 1. make sure it is slanted"
put " 2.make sure that it is flat"
put "3.make sure it look good"
put "4. make sure it has the right texture"
get number
colorback (40)
if number = 1 then
put " you are correct"
total := total + 1
end if
if number > 1 then
put " you are wrong"
put " the correct answer is 1"
end if
put " Hit any key to countine"
getch (key)
cls
colorback (40)
put " question 5"
put " Concrete crack because_______"
put "1. because people are walk on it to much"
put "2. because it is getting old and needs it to fix it"
put "3. because people are hitting it with a hammer"
put "4. because the ground and wet and the concrete is wet"
get number
colorback (40)
if number = 2 then
put " that is corect"
total := total + 1
end if
colorback (40)
if number < 2 then
put " you are wrong"
put " the correct answer is 2"
end if
colorback (40)
if number > 2 then
put " you are wrong"
put " the correct answer is 2"
end if
put " Hit any key to countine"
getch (key)
cls
colorback (40)
% This is the Bonus Question.
% If you do not get more then three wuestion right then you will not get this Question
if total> 2 then
put " Question 6"
put " What should you make the concrete slanted"
put "1. becasuse it looks pretty "
put "2. So that the water will run of of it "
put "3. becauase the conctre will not set right"
put "4. becauae they fell like it"
get number

if number = 2 then
put " you are correct"
total := total + 1
end if
if number > 2 then
put " you are wrong"
put " the correct answer is 2"
end if
if number < 2 then
put " you aer wrong"
put " the corrects answer is 2"
end if
end if

% The Following will ask you to press any key to contine then it will tell you
% thank you for playing
put " Hit any key to countine"
getch (key)
cls
colorback (40)
put " THANK YOU FOR PLAYING MY GAME TRIVIA"
colorback (40)

put " you score is", total
put "Thank You ", name, " for playing my game"

abysspell

Posted: Wed Nov 01, 2006 10:10 am   Post subject: (No subject)

You didn't need to post that 3 times you know.
darkworld99

Posted: Wed Nov 01, 2006 10:53 am   Post subject: (No subject)

abysspell wrote:
You didn't need to post that 3 times you know.

Note -- You just might need to!
Piro24

Posted: Wed Nov 01, 2006 7:34 pm   Post subject: (No subject)

I'm new to turing myself, or computer programming in that case, but I can tell you some simple mistakes already...

First, use the code box to make your code easier to read. Also, maybe use F2 to indent your code properly.

The music is also a little loud, an well - annoying.

When you ask the user if they'd like to contine, here:
 code: put " Hello ", name, " please Answer as many of the following Questions" put " Would you like to continue Y/N?" get letter put " Hit any key to countine" getch (key)

If you select "N" you still continue. You could easily put that into a loop and if the answer is yes than exit the loop.

Also, for if statements like this:
 code: if number < 2 then put " that is wrong" put " the corrects answer is 2" end if if number = 2 then put " you are correct" total := total + 1 end if colorback (40) if number > 2 then put " you are wrong" put " that correct answer is 2" end if

It would be easier to do something like
if number = 2 then
correct
else
incorrect
end if

There are a lot of ways you could make your code more interesting, IMO...For example a quiz that people may actually have a chance at knowing (questions like those from Millionare or something...)
bruized

Posted: Wed Nov 01, 2006 8:34 pm   Post subject: Re: Trivia Game

First off, since it's a trivia game I suggest you just fix a few spelling errors. It'll help with the overall appeal of your game.

Second...

Mathwiz wrote:
put " how many different types of concrete if there?"

put "1. 1"
put "2.4"
put "3.6"
put "4.2"
get number

This part gets really confusing. There's 2.4 different types of concrete? You should space it out like the first one or better yet just use a, b, c, d instead of the numbers (for the multiple choice). That way it's not a whole bunch of numbers and the user actually knows what to write (most likely), the letter corresponding to the number (if you need to then add that instruction ). One of the common mistakes with what you have might be that the user doesn't know whether to type a 3 or a 6 (for the third multiple choice as an example).

On a side note... Why are all the questions about concrete?

Otherwise, good job if its one of your first programs.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 5 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: