Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Phone book help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
walker12101




PostPosted: Wed May 29, 2013 3:22 pm   Post subject: Phone book help

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>


What is the problem you are having?
My code doesn't work and over laps its self.


Describe what you have tried to solve this problem
Ask other people and changing the code


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
My code is below and you will see what happens when you run the program. I need it to show up as a list after it receives the information but it doesn't work properly.
If you can post the fixed code. Thanks
Turing:


var fnames : array 1 .. 10 of string
var lnames : array 1 .. 10 of string
var num : array 1 .. 10 of string

put "Enter 10 First Names"
for i : 1 .. 10
    get fnames (i)
end for
put "Enter 10 Last Names"
for j : 1 .. 10
    get lnames (j)
end for
put "Enter 10 Numbers"
for k : 1 .. 10
    get num (k)
end for
delay (500)
cls
locate (1, 1)
put "First Names"
locate (1, 25)
put "Last Names"
locate (1, 40)
put "Phone Numbers"
locate (2, 1)
put "----------------------------------------------------------------------"
put ""
locate (4, 1)
for i : 1 .. 10
    put fnames (i)
end for
locate (4, 25)
for j : 1 .. 10
    put lnames (j)
end for
locate (4, 40)
for k : 1 .. 10
    put num (k)
end for




Please specify what version of Turing you are using
The newest type I believe
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Wed May 29, 2013 3:31 pm   Post subject: RE:Phone book help

Why don't you try outputting data one row at a time instead of one column? This would eliminate all of your calls to locate() and most of your for loops, which will simplify the code significantly.

For example, put fnames(i), then lnames(i), then num(i). Then move to the next row.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: