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

Username:   Password: 
 RegisterRegister   
 help how to create this picture using for loop
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
enchanted_bloom




PostPosted: Sun Mar 01, 2009 6:38 pm   Post subject: help how to create this picture using for loop

I really need help for this assignment. Can someone please help me and sent up the code for this assignment using for loop?
Write a program that will ask the user to enter any character on the keyboard. After reading in the users input, the program will clear the screen and then produce the output as seen below. You must use 2 for loops to get the pattern to appear properly on your screen.
"Please see this word document"

Thank you very much, i need this ASAP because it is due like tomorrow..Thanks again



Doc1.doc
 Description:

Download
 Filename:  Doc1.doc
 Filesize:  28 KB
 Downloaded:  71 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
syntax_error




PostPosted: Sun Mar 01, 2009 6:45 pm   Post subject: RE:help how to create this picture using for loop

Ahh, I see you have yet to read the rules here, and we do not do your homework for you, we do help you old in that thought although. How about you start attempting at least then we can help you fix your code so you finish that assignment.
enchanted_bloom




PostPosted: Sun Mar 01, 2009 6:55 pm   Post subject: RE:help how to create this picture using for loop

thanks...i didn't know..i tried various times..but it comes out weird..
Turing:
for counter:1..12
    put " ":counter,num
    for counter1:1..5
        put num," ":counter1
    end for
end for


Mod Edit: Remember to use syntax tags! Thanks Smile
code:
[syntax="turing"]Code Here[/syntax]
saltpro15




PostPosted: Sun Mar 01, 2009 7:17 pm   Post subject: RE:help how to create this picture using for loop

"thanks, i didn't know" what the heck were you expecting? as syntax_error said, we DO NOT do your homework for you here, this is an easy problem, just ask your teacher for help, you're on the right track with nested for loops
A.J




PostPosted: Sun Mar 01, 2009 7:34 pm   Post subject: Re: help how to create this picture using for loop

saltpro15 wrote:

"thanks, i didn't know" what the heck were you expecting? as syntax_error said, we DO NOT do your homework for you here, this is an easy problem, just ask your teacher for help, you're on the right track with nested for loops


don't be so harsh saltpro15 Sad

but he is right you know, enchanted_bloom...we DON'T do your programs for you

However, I don't mind pushing you in the right direction Wink

Basically, you want to output "****" over and over again, where the first line has 1 space in front of it, the second line has 3 spaces in front of it, the third line has 5 spaces in front of it....you see where I am going with this ?

What do you have to use to repeat the pattern with 1, 3, 5, 7, etc...spaces in front of it? For loops!
So use it (one for outputting the pattern with 1, 3, 5, etc...spaces, and another for outputting it backwards, like 7, 5, 3, 1 spaces)

I hope this helped Wink
enchanted_bloom




PostPosted: Sun Mar 01, 2009 7:35 pm   Post subject: RE:help how to create this picture using for loop

TT.TT..forgive me..im a beginner and I am really desperate..the part i didn't get is how to use for loop for spacing on one line
because according to the thing it is supposed to be like this
for counter:1..5
put ?Hello?
put counter, ? ?
end for

but when i tried it on turing..it turned out different..
Tony




PostPosted: Sun Mar 01, 2009 7:36 pm   Post subject: RE:help how to create this picture using for loop

what is weird about it?

Can you draw the pattern on paper yourself? Try doing so, and write down decisions that you make about each step. It is much easier to turn a list of written instructions into code.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
saltpro15




PostPosted: Sun Mar 01, 2009 7:39 pm   Post subject: RE:help how to create this picture using for loop

I don't want to sound like a total prick, sorry enchanted, although if you're really that desperate you could do it all with put statements Wink if not, I recommend Tony's suggestion
Sponsor
Sponsor
Sponsor
sponsor
enchanted_bloom




PostPosted: Sun Mar 01, 2009 8:30 pm   Post subject: RE:help how to create this picture using for loop

thanks for you guys's help...i'll try some more
chopperdudes




PostPosted: Mon Mar 02, 2009 12:02 am   Post subject: RE:help how to create this picture using for loop

enchanted, look into the repeat command in turing. see some relationships between how much you need to repeat, and something else?
A.J




PostPosted: Mon Mar 02, 2009 11:02 am   Post subject: RE:help how to create this picture using for loop

well, the repeat function could be used instead of the for loops (I guess)...but it would be better practice if you used the for loops instead (although 'repeat' would work too)
Lekegolo killer




PostPosted: Mon Mar 02, 2009 11:23 am   Post subject: RE:help how to create this picture using for loop

damn i wish i was in CS.
andrew.




PostPosted: Mon Mar 02, 2009 4:25 pm   Post subject: RE:help how to create this picture using for loop

You could still learn the basics of programming. Turing is a free download with the link above and there are a lot of tutorials here.
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  [ 13 Posts ]
Jump to:   


Style:  
Search: