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

Username:   Password: 
 RegisterRegister   
 Help me..
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
not_l33t




PostPosted: Sat Apr 03, 2004 11:27 am   Post subject: Help me..

Hey, it is my first time on this baord. I hope I make something good out of this. Well I am studying Turing in grade 10, in my high school (Toronto YAAH!).

Well it goes like this, my teacher has given us the book and just sits there on his ass, he hardly says or teach anything. Just wants us to do the stuff in the book , and the book ain't NOT so helpful.

Well you guys seem to be the gurus of Turing, so I have a question. I can't wrap my head around it. I hope you guys can.

" Ask the user for the upper left row and column and the bottom right row and column to represent the top left and bottom right corners of a rectangle. Ask the user for the number of the color they wish to use. Ask the user for the character indicated by the user going from the top-left to the top bottom-right co-ordinates."

I still don't get what I just typed down. Please help.
Sponsor
Sponsor
Sponsor
sponsor
guruguru




PostPosted: Sat Apr 03, 2004 1:09 pm   Post subject: (No subject)

By the way, "ain't NOT so helpful" is a double negative: it is not not so helpful, meaning that it is helpful Laughing !

Anyways... it asks you to get the x and y coordinates and color of a rectangle... i dont get the last part either Rolling Eyes .

code:
var x1, x2, y1, y2, color : int
put "What is x1? " ..
get x1
put "What is x2? " ..
get x2
put "What is y1? " ..
get y1
put "What is y2? " ..
get y2
put "What color? " ..
get color
Draw.FillBox (x1, y1, x2, y2, color)

There ya go...
Tony




PostPosted: Sat Apr 03, 2004 1:42 pm   Post subject: (No subject)

eh... I think the question asked to draw a line using ASCII Confused
code:

 var x1, x2, y1, y2, c : int
 var letter:string(1)
put "What is x1? " ..
get x1
put "What is x2? " ..
get x2
put "What is y1? " ..
get y1
put "What is y2? " ..
get y2
put "What color? " ..
get c
put "what character to use?"
getch(letter)

colorback(black) %black background
color(c) %sets text colour to that of user's choice
cls

var len:int := round(Math.Distance(x1,y1,x2,y2)) %length of the line
var angle:int := round(arctand((y2-y1)/(x2-x1)))
for i:1..len %for each segment of the line
locate(round((cosd(angle)*i)+x1),round((sind(angle)*i))+y1) %locates the character on the screen
put letter %places character
end for
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
not_l33t




PostPosted: Sat Apr 03, 2004 1:54 pm   Post subject: (No subject)

guruguru wrote:
By the way, "ain't NOT so helpful" is a double negative: it is not not so helpful, meaning that it is helpful Laughing !




Thank you, I know, its a purposeful fragment. It can be forgiven, depending on the situation. Very Happy

To Tony:

Thank you Tony. I will test this right now. It is very rare to see someone master Turing. Most of the time when I ask someone, they don't even have the least idea of this language. Exclamation

Well there is an error in one of the line.

code:
var len : int := round %(Math.distance (x1, y1, x2, y2)) %length of the line
Tony




PostPosted: Sat Apr 03, 2004 2:00 pm   Post subject: (No subject)

not_l33t wrote:
It is very rare to see someone master Turing.

Laughing
you should check out our [Best of Submissions] post for some interesting programs writen in turing Wink

as for the error - Math.Distance is a part of turing v4.0.5 - there's a link for upgrade on the main page
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Jodo Yodo




PostPosted: Sat Apr 03, 2004 10:51 pm   Post subject: (No subject)

Tony, I think your program is a bit too complicated. I remember that question, and I think you're only supposed to use stuff such as repeat (ch, x1) and stuff, not advanced things.
apomb




PostPosted: Sun Apr 04, 2004 12:23 pm   Post subject: (No subject)

Here is a simplified version of tony's , it fills a box with a specific character ...
code:
var x1, x2, y1, y2, c : int
var chara : string (1)
put "What is x1? " ..
get x1
put "What is x2? " ..
get x2
put "What is y1? " ..
get y1
put "What is y2? " ..
get y2
put "What color? " ..
get c
put "what character?"
getch (chara)
for i : x1 .. x2
    for ii : y1 .. y2
        locatexy (i, ii)
        color (c)
        put chara ..
    end for
end for

hope this helps!
not_l33t




PostPosted: Sun Apr 04, 2004 3:04 pm   Post subject: (No subject)

Tony dude:

It doesn't work. Sad When the script was executed the only output was the an alphabet I put in, in some color.


Compwiz

Dude that script doesn't go after the question of character. It just ends there.

PS. Simple non 4.0.5 commands would be good. Very Happy

Thank you again for your help guys.
Jodo Yodo




PostPosted: Sun Apr 04, 2004 9:47 pm   Post subject: (No subject)

Quote:

"Ask the user for the character indicated by the user going from the top-left to the top bottom-right co-ordinates."


What the ninny does this mean?
we64




PostPosted: Mon Apr 05, 2004 6:55 am   Post subject: (No subject)

People who wrote this question did not pass Grade 9 English Very Happy
I think CompWiz333's code looks like correct to me, I still don't get the last part.... it makes me remember the question on the Canadian Computer Competion....
Cervantes




PostPosted: Mon Apr 05, 2004 7:59 am   Post subject: (No subject)

not_l33t wrote:

Compwiz

Dude that script doesn't go after the question of character. It just ends there.


it works for me.. that thing about getch just makes it so that as soon as one character (letter / number key) is pressed the program uses that as the string variable and continues execution.
Tony




PostPosted: Mon Apr 05, 2004 8:03 am   Post subject: (No subject)

you might have picked a character color to be very similar to one of background so it's hard to see the output Confused

btw - my program works perfectly, though it might not be what the question is asking Laughing as we64 points out - this does remind me of this year's CCC, in sence that it doesn't make much sence and is open to interprepation. My program draws an ASCII line using input character between x1/y2 and x2/y2 row/columns.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
not_l33t




PostPosted: Mon Apr 05, 2004 12:00 pm   Post subject: (No subject)

Let me put the question again: (Oh man I hate this book.)

Quote:
Ask the user for the upper left row and column and the bottom right row and column to represent the top left and bottom right corners of a rectangle. Ask the user for the number of the color they wish to use. Ask the user for the character they wish to use. Create a filled in rectangle in the color and character indicated by the user going from top-left to the bottom-right co-ordinates.
we64




PostPosted: Mon Apr 05, 2004 8:38 pm   Post subject: (No subject)

are you sure you typed the question right? Very Happy Very Happy Very Happy
apomb




PostPosted: Tue Apr 06, 2004 11:48 am   Post subject: (No subject)

oh, sorry for the "complicated" code, but it does draw a square and fills it with a letter inputted by the user, as well as inputted colors for both ascii character and background... since
Quote:
Create a filled[ in rectangle in the color and character indicated by the user going from top-left to the bottom-right co-ordinates.

uumm there is no 4.0.5 code anyway...! Smile
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 2  [ 21 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: