Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Help me..
Author Message
not_l33t

Posted: 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."

guruguru

Posted: 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 !

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

 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

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

eh... I think the question asked to draw a line using ASCII
 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
Tony's programming blog. DWITE - a programming contest.
not_l33t

Posted: 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 !

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

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.

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

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

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

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

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

Posted: 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

Posted: 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

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

Tony dude:

It doesn't work. 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.

Thank you again for your help guys.

Jodo Yodo

Posted: 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

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

People who wrote this question did not pass Grade 9 English
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

Posted: 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

Posted: 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

btw - my program works perfectly, though it might not be what the question is asking 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.
Tony's programming blog. DWITE - a programming contest.
not_l33t

Posted: 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

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

are you sure you typed the question right?
apomb

Posted: 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...!
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 2  [ 21 Posts ]
Goto page 1, 2  Next
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: