Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
lotto 649
Author Message
GUI.GetScrollBarWidth : i

Posted: Wed Feb 18, 2004 12:04 pm   Post subject: lotto 649

var num1, num2, num3, num4, num5, num6, numm1, numm2, numm3, numm4, numm5, numm6 : int
var c1, c2, c3, c4, c5, c6 : int := 0
cls
put "play lotto649."
put "the 649 is how many millions of \$ we steal"
loop
randint (num1, 1, 49)
randint (num2, 1, 49)
randint (num3, 1, 49)
randint (num4, 1, 49)
randint (num5, 1, 49)
randint (num6, 1, 49)
if num1 not= num2
and num1 not= num3
and num1 not= num4
and num1 not= num5
and num1 not= num6
and num2 not= num3
and num2 not= num4
and num2 not= num5
and num2 not= num6
and num3 not= num4
and num3 not= num5
and num3 not= num6
and num4 not= num5
and num4 not= num6
and num5 not= num6
then
exit
end if
end loop
get numm1
get numm2
get numm3
get numm4
get numm5
get numm6
cls
cls
put "the winning numbers are:"
put " ", num1, " ", num2, " ", num3, " ", num4, " ", num5, " ", num6
put ""
put " ", numm1, " ", numm2, " ", numm3, " ", numm4, " ", numm5, " ", numm6
var pic := Pic.FileNew ("lotto pic3.bmp")
Pic.Draw (pic, 0, 50, picCopy)
if num1 = numm1 then
put
"you got the first number right"
else
put "you got the first number wrong"
if num2 = numm2 then
put "you got the second number right"
else
put "you got the second number wrong"
if num3 = numm3 then
put "you got the third number right"
else
put "you got the third number wrong"
if num4 = numm4 then
put "you got the foruth number right"
else
put "you got the foruth number wrong"
if num5 = numm5 then
put "you got the fifth number right"
else
put "you got the fifth number wrong"
if num6 = numm6 then
put "you got the sixith number right"
else
put "you got the sixith number wrong"
end if
end if
end if
end if
end if
end if

i'm bord so i posted this, imade it for school

Paul

Posted: Wed Feb 18, 2004 8:59 pm   Post subject: (No subject)

Keep trying lucas, good start, here's some bits so you wouldn't say "Gymasium" anymore.
Scorne

Posted: Mon Jun 28, 2004 11:06 pm   Post subject: Randomizing numbers for whatever reason.

I did this stuff 4 years ago and forget how..

How would i make a program to Randomize (3,6,12,24) numbers(1 set)
from like (X amount) sets of 12 numbers..

So i input x (120, 60, etc numbers).. to create (3,6,12,24) numbers

Catch my drift..?

Just to make sure its all smooth..

------
"How many Numbers do you want Randomized?"
(3,6,12,24)
"How many Sets of (3,6,12,24) will be randomized?"
(3,6,12,24)
"Please input the first (3,6,12,24) digits"
768645
" "
" "
"Please input the last (3,6,12,24) digits"
877678

"From those numbers "
999999 was generated
Tony

Posted: Tue Jun 29, 2004 12:12 am   Post subject: (No subject)

wow, I'm lost... your problem doesnt seem to make any sence...

and how does it have anything to do with a lottery game?
Tony's programming blog. DWITE - a programming contest.
Cervantes

Posted: Tue Jun 29, 2004 9:42 am   Post subject: (No subject)

umm, "lucas", if that's your name: your if statements at the end are all wrong.
here's why:
starting at line 51:
if the number you picked equals the first number of the lottery then put "you got the first number right" and skip the entire else section and continue the program at end if. so even if you got all 5 of the other numbers right, the program still won't output that you got them right if you got the first number right.
you could fix this by doing something like this:
 code: var lotto_num : array 1 .. 6 of int var picked_num : array 1 .. 6 of int var correct_num : array 1 .. 6 of boolean for i : 1 .. 6     correct_num (i) := false %initializing all elements of correct_num to false end for var exit_loop : boolean % generating the numbers.  most of this is to ensure that no 2 numbers are the same. for l : 1 .. 6     loop         exit_loop := true         lotto_num (l) := Rand.Int (1, 49)         for decreasing c : l - 1 .. 1             if lotto_num (l) = lotto_num (c) then                 exit_loop := false             end if         end for         exit when exit_loop     end loop end for for p : 1 .. 6     put "Enter number ", p, " : " ..     loop         exit_loop := true         locate (p, 17)         get picked_num (p)         if picked_num (p) < 1 or picked_num (p) > 49 then             exit_loop := false         end if         for c : 1 .. p - 1             if picked_num (c) = picked_num (p) then                 exit_loop := false             end if         end for         exit when exit_loop         locate (p, 17)         put "                           " %covers up prevously enter number.  this line is not executed it exit_loop is true coming out of the for loop     end loop end for cls put "the winning numbers are:" for l : 1 .. 6     put " ", lotto_num (l) .. end for put "" put "" put "your numbers are" for p : 1 .. 6     put " ", picked_num (p) .. end for put "" %%CHECKING users numbers against the generated numbers%% for p : 1 .. 6     for l : 1 .. 6         if picked_num (p) = lotto_num (l) then             correct_num (p) := true         end if     end for end for for f : 1 .. 6     if correct_num (f) then     % same as    if correct_num (f) = true then         put "you got your ", f, "th number RIGHT.  you picked ", picked_num (f), "."     else         put "you got your ", f, "th number WRONG.  you picked ", picked_num (f), "."     end if end for
the_short1

Posted: Tue Jun 29, 2004 3:25 pm   Post subject: (No subject)

also the arrays are very useful in this... <cervants just added them rite?

but other then that.... i like ur program... nice ... simple.. and to the point..

some suggestions: (just suggestions)

-Add GUI Buttons <since thats in ur name
-Maybe add a GUI keypay to enter the numbers (pm me if u want the source code)
Paul

Posted: Tue Jun 29, 2004 3:48 pm   Post subject: (No subject)

yea... look at the date on that thing... plus I know that he's prolly not coming back to compsci again and not programming again.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

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