Computer Science Canada what is..... |
Author: | ecookman [ Mon Oct 20, 2008 10:43 am ] |
Post subject: | what is..... |
just wondering i am completly lost with this question i have for home work could someone explain what i have to do NOT DO IT FOR ME the question... Write a program that will ask the user to enter an integer. Your program should check to see if the user entered a valid integer and output an appropriate message depending on whether the user correctly entered an integer or not. Hint: Review the strintok function so just wondering what this is asking (in a dumbed down version) |
Author: | Insectoid [ Mon Oct 20, 2008 11:04 am ] |
Post subject: | Re: what is..... |
It's checking to make sure the user did indeed enter a number. If a letter is entered, it will say 'no, you did not enter a number', while if a number is entered, it will say 'yes, you did enter a number'. Hints: Strintok- will check if the input can be converted to an integer. Strint- will convert the string to an integer. This is useful as is stops your programs from crashing due to users entering a letter when asked for an int/real. |
Author: | ecookman [ Wed Oct 22, 2008 7:51 am ] |
Post subject: | RE:what is..... |
ok so somethig like this??? var num : string var check : real put "ello' i am a thingy.... that does something....ummmm...i think you are suposto' enter a number..." get num %check startment loop if not strrealok (num) then put " I SAID ENTER A NUMBER" get num exit when strrealok (num) end if end loop check := strreal (num) put "now was entering a number so hard..????, entering the number, ",check ANS SRRY I DON'T KNOW HOW TO MAKE THE COLORS DIFFERENT AND HAVE LIKE Turing: blahblah(balck and blue) |
Author: | Insectoid [ Wed Oct 22, 2008 12:21 pm ] | ||
Post subject: | RE:what is..... | ||
|
Author: | The_Bean [ Wed Oct 22, 2008 12:24 pm ] |
Post subject: | Re: what is..... |
1) Name the topic of your post something better than "what is..." 2) If the teacher tells you to use a certain function, look it up in the help menu first and try to firgure out how to use for yourself 3) For the solution you put, if you enter an integer the first time around, you then you get stuck in a never ending loop. 4) There is alot simpler way of doing this. 5) Your suppose to use the strintok function not strrealok, even though they do a similare thing. 6) If you enter an integer right away your still being rude to the user with the last line even though they didn't do anything wrong. |