Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
[source] almost done "Who wants to be a milionaire"
Author Message
DanShadow

Posted: Tue Jan 20, 2004 5:48 pm   Post subject: [source] almost done "Who wants to be a milionaire"

Here is a start to "Who Wants to be a Millionaire":
 code: var questions:array 1..10 of string var choice1,choice2,choice3,choice4,real_answer:array 1..10 of string var money_for_question:array 1..10 of int var lifelinez:array 1..3 of string var lifeline_used:array 1..3 of boolean var input:string:="" var money,num:int:=0 lifelinez(1):="Ask the Audience" lifelinez(2):="Fifty Fifty" lifelinez(3):="Phone a Friend" for i:1..3 lifeline_used(i):=false end for procedure lifelines put "Lifelines: ".. for i:1..3 put lifelinez", ".. end for put "" put "Which lifeline do you wish to use: ".. get input:* if input="Ask the Audience" and lifeline_used(1)=false then ask_the_audience elsif input="Fifty Fifty" and lifeline_used(2)=false then fifty_fifty elsif input="Phone a Friend" and lifeline_used(3)=false then phone_a_friend else put "That is not a lifeline, or it has already been used..." end if num:=num-1 end lifelines procedure ask_the_audience %Ask the Audience procedure lifeline_used(1):=true end ask_the_audience procedure fifty_fifty %50/50 procedure lifeline_used(2):=true end fifty_fifty procedure phone_a_friend %Phone a Friend procedure lifeline_used(3):=true end phone_a_friend put "Welcome to Who Wants to be a Millionaire!!" put "HINT: Type 'lifeline' to use a lifeline." put "" loop num:=num+1 put "Question: " question (num) put "a) green ",choice1(num) put "b) white ",choice2(num) put "c) blue ",choice3(num) put "d) brown",choice4(num) put "Answer: ".. get anwer if answer = real_answer (num) then money:= money+money_for_question(num) elsif answer = "lifeline" then lifelines elsif answer not = real_answer(num) then put "Sorry buddy, you LOSE!" exit end if exit when num>=10 end loop if num=10 then put "Congratulations! You won ",money," dollars!!" else put "You have lost everything...now go home and cry yourself to sleep!" end if

Just change the array max values to the number of questions you have...and create the questions, choices, and real answer. Also, create what happens in the lifelines, and how much money you'll get per question. This is a good start to "Who Wants to be a Millionaire!", and i've already answered this too many people, so if you dont understand this, PM me. I wont do your whole project for you, but this is pretty much how it goes. No more having like dozens of people adding me to their msn seeking help.. gr
Warning!
Seeing as this is being posted on CompSci...multiple people may be using it as their project..so, if your teacher finds like a dozen of you out there with the same project, it is NOT in any way my fault!

Enjoy the code, and put it to good use!s
 Fixed a couple bugs...should work now
Sponsor
Sponsor

kalin

Posted: Wed Jan 21, 2004 3:30 pm   Post subject: (No subject)

Hey!! What about me??
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 2 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: