----------------------------------- not_l33t Sat Apr 03, 2004 11:27 am 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. ----------------------------------- guruguru Sat Apr 03, 2004 1:09 pm ----------------------------------- By the way, "ain't NOT so helpful" is a double negative: it is not not so helpful, meaning that it is helpful :lol: ! Anyways... it asks you to get the x and y coordinates and color of a rectangle... i dont get the last part either :roll: . 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 Sat Apr 03, 2004 1:42 pm ----------------------------------- eh... I think the question asked to draw a line using ASCII :? 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 ----------------------------------- not_l33t Sat Apr 03, 2004 1:54 pm ----------------------------------- By the way, "ain't NOT so helpful" is a double negative: it is not not so helpful, meaning that it is helpful :lol: ! Thank you, I know, its a purposeful fragment. It can be forgiven, depending on the situation. :D 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. var len : int := round %(Math.distance (x1, y1, x2, y2)) %length of the line ----------------------------------- Tony Sat Apr 03, 2004 2:00 pm ----------------------------------- It is very rare to see someone master Turing. :lol: you should check out our [url=http://www.compsci.ca/v2/viewtopic.php?t=4278][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 ----------------------------------- Jodo Yodo Sat Apr 03, 2004 10:51 pm ----------------------------------- 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 Sun Apr 04, 2004 12:23 pm ----------------------------------- Here is a simplified version of tony's , it fills a box with a specific character ... 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 Sun Apr 04, 2004 3:04 pm ----------------------------------- 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. :D Thank you again for your help guys. ----------------------------------- Jodo Yodo Sun Apr 04, 2004 9:47 pm ----------------------------------- "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 Mon Apr 05, 2004 6:55 am ----------------------------------- People who wrote this question did not pass Grade 9 English :D 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 Mon Apr 05, 2004 7:59 am ----------------------------------- 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 Mon Apr 05, 2004 8:03 am ----------------------------------- 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 :lol: 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. ----------------------------------- not_l33t Mon Apr 05, 2004 12:00 pm ----------------------------------- Let me put the question again: (Oh man I hate this book.) 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 Mon Apr 05, 2004 8:38 pm ----------------------------------- are you sure you typed the question right? :D :D :D ----------------------------------- apomb Tue Apr 06, 2004 11:48 am ----------------------------------- 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 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...! :) ----------------------------------- zylum Tue Apr 06, 2004 7:19 pm ----------------------------------- maybe this is what you're looking for? 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) cls color(c) for i : y1 .. y2 locate (maxrow - i, x1) put repeat (chara, x2 - x1 + 1) end for -zylum ----------------------------------- the_short1 Tue Apr 06, 2004 8:03 pm ----------------------------------- zylums got it...... yea i had tmake a similiar program... except once it was just drawing in a verticle... then another program to make a horizontal... (in both cases we used astericksts...)... leave it to tony to always use Math.Distance...