
-----------------------------------
Risen123
Thu Nov 08, 2012 12:50 pm

Need help!
-----------------------------------
[I have a test tommorow that is open book. I have been busy with family issues so haven't had time to study and learn all of these in class.

Questions should be fully coded, they are the following!

1.Input a word, once inputted make the word spelt vertically with a space between each letter

2.When a sentance is inputted, delete the spaces between the sentance and output it

3.Open a file and add all the numbers in the file a nd output the sum

4.Input a word and space it out in between letters

5.Take all the a's and turn them into z's in the sentance

6.Go through a text file and count how many numbers there are

-----------------------------------
Tony
Thu Nov 08, 2012 1:04 pm

RE:Need help!
-----------------------------------
Thx for sharing!

-----------------------------------
Risen123
Thu Nov 08, 2012 3:34 pm

RE:Need help!
-----------------------------------
Somebody help please!

-----------------------------------
evildaddy911
Thu Nov 08, 2012 3:58 pm

RE:Need help!
-----------------------------------
thank you for telling us this. Shall I assume you want help with this?

What the teacher wants you to do is basically string manipulation. string manipulation generally goes as such:

for i : 1 .. length (string)
    %
    %
end for


One thing you need to keep in mind is that strings are essentially arrays, each element being one  character.

-----------------------------------
Risen123
Thu Nov 08, 2012 4:16 pm

RE:Need help!
-----------------------------------
It would help if I could get an example of a few of them so I know what I'm looking for, I literally missed 3 weeks of school because my parents were divorcing and I went into clinical depression

Please anyone!

-----------------------------------
Tony
Thu Nov 08, 2012 4:40 pm

RE:Need help!
-----------------------------------
a good example would be

var word : string
put "enter a word"
get word

for i : 0 .. length(word) - 1
   put "letter in position ", i, " is: ", word(i)
end for


-----------------------------------
Risen123
Thu Nov 08, 2012 5:02 pm

RE:Need help!
-----------------------------------
#1, #3, #6 if answered would be amazing!

-----------------------------------
[Gandalf]
Thu Nov 08, 2012 5:29 pm

Re: Need help!
-----------------------------------
We won't answer your test questions for you, or do your homework for you.  Although, if you search through these forums I'm sure you'll find code very similar to what you need, and probably learn a thing or two.  You can start with the [url=http://compsci.ca/v3/viewtopic.php?t=8808]Turing Walkthrough.

-----------------------------------
Tony
Thu Nov 08, 2012 5:32 pm

RE:Need help!
-----------------------------------
My example is really really close to what #1 is asking for. What part is it missing? How do you think that could be solved?

#3,6 are presumably difficult because they deal with files. The Turing Walkthrough is your crash course through everything Turing, which links you to a File Tutorial -- http://compsci.ca/v3/viewtopic.php?t=12972 You will only need "put" and "get" modes of access. Don't worry about "read" or "write".

-----------------------------------
Risen123
Thu Nov 08, 2012 6:36 pm

RE:Need help!
-----------------------------------
I have #1 but it makes the text backwards! how do you fix that?


var line : string

% Input a string from the user

locate (1, 1)

put "Enter a phrase. " ..
get line : *

% Display sentence with spaces between them

for decreasing i : length (line) .. 1
    put line (i), " " ..
end for

-----------------------------------
Insectoid
Thu Nov 08, 2012 6:40 pm

RE:Need help!
-----------------------------------
[code]for decreasing i : length (line) .. 1 [/code]

Hmm, I wonder what the problem could possibly be. Can't seem to find anywhere! I thought it would be painfully obvious, but evidently I was wrong.

-----------------------------------
Risen123
Thu Nov 08, 2012 6:42 pm

RE:Need help!
-----------------------------------
I don't know how to fix it! I went complete dummy on it :(

I tried making it increasing, didn't work

how do I fix it? :o

-----------------------------------
Aange10
Thu Nov 08, 2012 7:01 pm

RE:Need help!
-----------------------------------
Listen to what they're telling you. The Turing Walkthrough has your answer.

http://compsci.ca/v3/viewtopic.php?t=3678

-----------------------------------
Risen123
Thu Nov 08, 2012 7:07 pm

RE:Need help!
-----------------------------------
I looked through the guide, I changed decreasing to counter and it says i needs to be declared!

I'm so confused!

-----------------------------------
Risen123
Thu Nov 08, 2012 7:10 pm

RE:Need help!
-----------------------------------
Ok I got #1 and #4, thank you!

-----------------------------------
Insectoid
Thu Nov 08, 2012 7:28 pm

RE:Need help!
-----------------------------------
#2: Output the letters as normal. If the letter is a space, don't. 

#3:literally just turn the question into code. It can't really be simplified further.

#5: Same as number 2, except instead of looking for spaces, look for As, and instead of not outputting them, output a Z.

#6: Same as number 2, except instead of looking for spaces, look for numbers, and instead of not outputting them, increment a counter.

-----------------------------------
Tony
Fri Nov 09, 2012 1:04 am

Re: RE:Need help!
-----------------------------------

for decreasing i : length (line) .. 1

So... where did you copy this line of code from?
