Rand Int
Author |
Message |
WesWes
|
Posted: Mon Dec 16, 2002 11:22 pm Post subject: Rand Int |
|
|
Damn, sorry about these idiot help posts.. But, I left my notes somewhere, and I have to get this done tonight..
How can I do random numbers?
Thanks!! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
WesWes
|
Posted: Mon Dec 16, 2002 11:39 pm Post subject: (No subject) |
|
|
Screw that. Well, no, I still need it, but I need help with this next thing more.
I'm making a personality quiz thing, and I need it to do the calculations without display them.
It's off an if statement, so I have to "put" something.
Here it is"
%Ques1
put "Note: When selecting, please type in just the lower case letter of your choice. Do NOT put 'x)'! Just put 'x'"
put " "
put " "
put "1. Which of the following do you think is LEAST important?"
put "a) Speed"
put "b) Strength"
put "c) Intelligence"
put "d) Evilness"
get q1
if q1 = "a" then
I NEED TO PUT SOMETHING HERE
flash + 1
elsif q1 = "b" then
put " ",
hulk + 1
elsif q1 = "c" then
put " ",
bat + 1
elsif q1 = "d" then
put " ",
ven + 1
end if
What can I do? |
|
|
|
|
|
Tony
|
Posted: Tue Dec 17, 2002 12:47 am Post subject: (No subject) |
|
|
randint(x,1,10)
or x := Rand.Int(1,10)
bout the second one, why do you need to put anything there?
just
if ans= "a" then
x:=x +1
end if
if statment doesn't have to output anything |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
FizixMan
|
Posted: Tue Dec 17, 2002 12:49 am Post subject: (No subject) |
|
|
First off:
for random integers, it's simply
randint(VARIABLE, LOWER_BOUND, UPPER_BOUND)
so if I wanted a random integer between -5 and +5 for variable "x"
randint(x,-5,5)
You should also put in "randomize" at the start of your program, otherwise everytime you run it, it will go through the same random integers over and over again. (i.e. if you run it and it returns 5, -2, 0, 1, then the next time you run it you will get 5, -2, 0, 1 again. By putting randomize, you won't get that re-occurance.)
And for the second question... I don't see why you need a "put" statement at all... |
|
|
|
|
|
FizixMan
|
Posted: Tue Dec 17, 2002 12:51 am Post subject: (No subject) |
|
|
gah; we just be posting at the same time eh Tony? Well, I guess you have the 4+ versions covered and I got the 3+ versions covered |
|
|
|
|
|
WesWes
|
Posted: Tue Dec 17, 2002 8:38 pm Post subject: (No subject) |
|
|
Thanks, dudes.
Can you tell I'm a newbie? |
|
|
|
|
|
Tony
|
Posted: Tue Dec 17, 2002 8:46 pm Post subject: (No subject) |
|
|
ya, it says so under your name
WesWes
newbe
other then that, don't worry about it.. You'll learn. Its not as hard as you think |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
krishon
|
Posted: Tue Dec 17, 2002 8:48 pm Post subject: (No subject) |
|
|
lol, i'm a perfect example. i used to know nothing about turing in september, now i'm competent at it. I'm saying COMPETENT, i'm not like dan or tony, those guys are geniouses, lol. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
azndragon
|
Posted: Tue Dec 17, 2002 8:59 pm Post subject: (No subject) |
|
|
I'm even newer at it. I started about two weeks ago, and I don't really consider myself to be good, but I'm well ahead of the class, they're just learning for loops. |
|
|
|
|
|
Tony
|
Posted: Tue Dec 17, 2002 9:16 pm Post subject: (No subject) |
|
|
ya, I learned Visual Basic in two weeks cuz I "skipped" a year of programming |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Dan
|
Posted: Wed Dec 18, 2002 1:15 am Post subject: stuff |
|
|
well personly i think that turing is one of the easted ones to learen beucse probley becuse it dose not need you to know may of the consptes of object ortende progaming. it took me about a week to learn turing fully and i started QFTB after a month.
even tho i relay dont like a few things about turing it can be a good strating point for some poleop into progaming. the hrad stuff is when you get deep into oop (object orted progaming) like wirting your own calsses in MFC.
also i was whoding if any one was going to go in to a creaer in progaming? |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
Tony
|
Posted: Wed Dec 18, 2002 3:09 pm Post subject: (No subject) |
|
|
ya, tell Dan if you're considering... this way he'd know who's computer to break so he'll have more opportunities
j/k
Though turing is easy... cuz its very basic. Its not even Object Oriented (You might think that it is, but its not. Holt actually renamed it to just Turing and dropped OO)
You don't have to reference anything or add any other stuff... Thats why you get a half a meg exe file after compiling put "hello world"
I guess its the easiest to start off with cuz you don't need to bother with the syntax or anything "complex". I just don't think its right to keep on using turing after you learned the basics of programming. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
FizixMan
|
Posted: Wed Dec 18, 2002 4:53 pm Post subject: (No subject) |
|
|
When you're learning computer programming for the first time, the most important thing you need to develop is your mind. In that you need to be able to think like a computer does and think very logically. You could know the ins and outs of Java syntax *shudders* but if you can't think logically about how to program it, you're stuck. Turing is good in that respect because it helps train your mind to think like a computer does. It helps develop that logic while not having to worry about syntax. Syntax is easy if you have the right compiler and all, but syntax alone won't write the program; your logic does. Once your mind has been trained properly to think logically, then you can move onto other, more applicable languages. It just becomes a matter of learning the new syntax and learning about object-oriented programming.
And besides... even though I'm learning Java now, I still find myself programming in turing making simple .exe's to perform simple file I/O formatting raw data into nicely laid out information. (or just trying to output a googolplex to a single .txt file... note: current computer hard drives are not big enough to do such a thing )
But when it comes down to it, the simplicity of Turing, in my opinion, makes it a great tool to introduce people to computer programming.
(does anyone remember what this thread was for now? lol ) |
|
|
|
|
|
|
|