Computer Science Canada

how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

Author:  cwlvc [ Tue Jan 08, 2008 6:25 pm ]
Post subject:  how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

do you guys know how i can first ask the view to "input a number between 1 and 5, then press enter"

then after they press enter, the computer should say "the number you entered is..."

Author:  syntax_error [ Tue Jan 08, 2008 6:42 pm ]
Post subject:  Re: how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

ahh you should really really read through this : The..Turing..Walkthrough


but jsut to answer your question
here a little bit
Turing:


var num:int
put "enter a number from 1 to 5"

if num <=5 & num <=1 then
put "you number was "+num
end if

else put "your number was not form 1 to 5"

Author:  shakin cookie [ Tue Jan 08, 2008 6:44 pm ]
Post subject:  RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

it is simple. Here is the syntax:

var number:int

proc repeat
put "Please enter a number from 1 to 5: " ..
get [number]
end repeat
proc display
put "The number you entered is", [number]
end display

Author:  Euphoracle [ Tue Jan 08, 2008 6:45 pm ]
Post subject:  RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

syntax_error, you have a Syntax error :p

Author:  shakin cookie [ Tue Jan 08, 2008 6:46 pm ]
Post subject:  RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

ya, because there are no real square brackets... im just putting them to show the variable.

Author:  syntax_error [ Tue Jan 08, 2008 6:48 pm ]
Post subject:  Re: how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

ahh ya i realized after i put submit
but then some one already replied to my post so couldnt edit

any mods want to delete me code?

this is what happens when you try mult tasking too much Crying or Very sad

Author:  shakin cookie [ Tue Jan 08, 2008 6:53 pm ]
Post subject:  RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

im really sorry

Author:  Zampano [ Tue Jan 08, 2008 6:57 pm ]
Post subject:  Re: how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

The hilariousness of this thread is proportional to how confusing it is.

Not only do you have a syntax error, you have an error which makes the program operate not how it should, though not because of broken syntax.

Author:  syntax_error [ Tue Jan 08, 2008 7:00 pm ]
Post subject:  Re: how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

yes yes i see it all........

stupid book could put it down..... o well s/he got the idea of what to use i hope......

nonetheless ANY MODS remove the coding although the link is a gud idea to leave Wink

Author:  cwlvc [ Tue Jan 08, 2008 7:00 pm ]
Post subject:  Re: RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

shakin cookie @ Tue Jan 08, 2008 6:44 pm wrote:
it is simple. Here is the syntax:

var number:int

proc repeat
put "Please enter a number from 1 to 5: " ..
get [number]
end repeat
proc display
put "The number you entered is", [number]
end display


lol, wait, i don't get this. so instead of the number what do i put.

because i need to program that will run. so in the run screen, the computer (me) will ask the view to "type in a number, then press enter". so after the viewer pressed enter, the computer(me) will then say "the number you inputed is ...) but all of this should happen in the screen after you press "run"

Author:  HeavenAgain [ Tue Jan 08, 2008 7:06 pm ]
Post subject:  RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

Interestingly, this problem is VERY beginner, you simply have to know about variable, user input, output, if statement , and just maybe a simple loop (and the posts above explained more than detailed)

now looking at your other post you seem to have a great understand of them, and beyond
now, instead of feeding this person answers, lets ask, what is the problem?

Author:  Zampano [ Tue Jan 08, 2008 7:15 pm ]
Post subject:  Re: how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

That would have been ten times more smart and cool sounding if you hadn't mispelled 'understand(ing)'. :D

Author:  cwlvc [ Tue Jan 08, 2008 7:15 pm ]
Post subject:  Re: RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

HeavenAgain @ Tue Jan 08, 2008 7:06 pm wrote:
Interestingly, this problem is VERY beginner, you simply have to know about variable, user input, output, if statement , and just maybe a simple loop (and the posts above explained more than detailed)

now looking at your other post you seem to have a great understand of them, and beyond
now, instead of feeding this person answers, lets ask, what is the problem?


lol. when i copy and pasted the guy's post (which is pretty high tec for me Embarassed ), it shows errors and i have no idea how to fix it.

Author:  cwlvc [ Tue Jan 08, 2008 7:18 pm ]
Post subject:  Re: how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

Zampano @ Tue Jan 08, 2008 7:15 pm wrote:
That would have been ten times more smart and cool sounding if you hadn't mispelled 'understand(ing)'. Very Happy


people here are just as picky as people in hoopshype.com/forum. Shocked lol

i'm the guy known for his bad grammer, which gets picked on a lot.

Author:  HeavenAgain [ Tue Jan 08, 2008 7:40 pm ]
Post subject:  RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

Very Happy i dont mind, because i know i have a bad grammar/english but its all cool, but hey, at least i tried.. to sound cool , plus , if you could understand me, then its all good all good
cough..cough... Rolling Eyes

back to your problem.... in your other post, i noticed how you said "so to get what this is what i wrote for the first part(which i got correct, now i need to add in the twist)"
so simply i assumed you've written all your work, unless my english failed me again
i strongly suggest you go here and read "the basic" "If structures" and "Loops and For loops" this will get you quite far Wink

Author:  cwlvc [ Tue Jan 08, 2008 7:47 pm ]
Post subject:  Re: RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

HeavenAgain @ Tue Jan 08, 2008 7:40 pm wrote:
Very Happy i dont mind, because i know i have a bad grammar/english but its all cool, but hey, at least i tried.. to sound cool , plus , if you could understand me, then its all good all good
cough..cough... Rolling Eyes

back to your problem.... in your other post, i noticed how you said "so to get what this is what i wrote for the first part(which i got correct, now i need to add in the twist)"
so simply i assumed you've written all your work, unless my english failed me again
i strongly suggest you go here and read "the basic" "If structures" and "Loops and For loops" this will get you quite far Wink


i should. now i'm lost, so tomorrow when i get to school, i'll get a clear idea of what i'll need to do.

but i got what i needed though. Wink

var num : int
put "Enter a number nigga"
get num
put "The number u just entered is ", num

now the question is how do i repeat this step?

and after i got my second number, how do i make the computer multiply the 2 numbers and give out the sum on the run screen.

Author:  Clayton [ Tue Jan 08, 2008 10:22 pm ]
Post subject:  RE:how to tell viewer to put in a number between 1 to 5, then press enter, then it gives out the number.

The next step is loops. Look for them in the Turing Walkthrough.


: