
-----------------------------------
JLChow
Tue Nov 03, 2015 5:08 pm

Can someone please explain to me how to use words in 'for' statements?
-----------------------------------
What is it you are trying to achieve?
Trying to understand how to use words in loops and repetition in general. These questions below ere given tome to practice but I don't understand how to complete them. I have tried various methods but something is always wrong.


What is the problem you are having?
These are the questions/problems that were given to me:

Write a program that reads words entered one to a line and

counts how many words have been entered before you give 

the signal word "end" to stop execution of the program. 

Experiment to determine what happens if you put several 

words on a line as you enter them.

and

 A series of marks is to be entered and averaged. 

Before you enter the series you are to have the program ask you how 

many marks there are in the series then read it in. Test your 

program to see that it works for series of different lengths, say 

four marks or six marks.

and finally the big one...

6.aWrite a program to output a table of values of the integers 

starting at 1 and their squares. Label the table at the top of the 

columns. For example, your output might look like this

Number Square

1             1

2             4

3             9

4             16

5 25

Try to format the output so that it looks attractive. What 

happens as the numbers get larger and larger? Change the 

122 Introduction to Programming in Turing




Describe what you have tried to solve this problem
Tried using various methods which I have not saved...but everytime it would fail.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
N/A Will try to provide ASAP.







Please specify what version of Turing you are using

 :canada:  :canada:  :canada:  :canada:  :canada: 

-----------------------------------
Tony
Tue Nov 03, 2015 6:07 pm

RE:Can someone please explain to me how to use words in \'for\' statements?
-----------------------------------
You should give an example of what you've tried and how it went wrong, to set context on what direction you are heading in, and what kind of problems should be solved. This makes the difference between "you should try this other command" and "you have the right approach, but use this command differently".
