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

Username:   Password: 
 RegisterRegister   
 how make a box using text mode,mine doesn't work please help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
bilal




PostPosted: Thu Feb 10, 2005 8:35 pm   Post subject: how make a box using text mode,mine doesn't work please help

%this is my program i can anyone fix because mine doesn't work, also the user has to output the numbers for the box and his is to be done in text mode
var x1, x2, y1, y2 : int
var c : string
put "Enter width of the box for :"
get x1
put "Enter height of the box in pixels:"
get x2
put "Enter x-coordinate of the lower-left corner of the box in pixels:"
get y1
put "Enter y-coordinate of the lower-left corner of the box in pixels:"
get y2
put "enter the character "
get c
cls
for horiz : 1 .. 80
locate (horiz,x2)
put c ..
locate (horiz,x1)
put c..
end for
for width : 1 .. 25
locate (y1, width)
put c ..
locate (y2, width)
put c..
end for
Sponsor
Sponsor
Sponsor
sponsor
ssr




PostPosted: Thu Feb 10, 2005 10:37 pm   Post subject: (No subject)

One suggestion first
use
code:
This
ssr




PostPosted: Thu Feb 10, 2005 10:39 pm   Post subject: (No subject)

Do u really want the "for"?
ummm...
So u r making a program that draws boxes in chars eh? Very Happy
is it?
Neo




PostPosted: Thu Feb 10, 2005 11:02 pm   Post subject: (No subject)

Use the font commands instead as locate is not the same on every computer.
Here is some code to get you started:

code:

var width, x, y : int
var widthChar, character : string := ("")
var font : int := Font.New ("ROCKWELL:9:BOLD")

put "Enter width of the box for :"
get width
put "Enter x-coordinate:"
get x
put "Enter y-coordinate:"
get y
put "Enter Character:"
get character

for i : 1 .. width
    widthChar += character
end for

Font.Draw (widthChar, x, y, font, black)
Neo




PostPosted: Thu Feb 10, 2005 11:03 pm   Post subject: (No subject)

EDIT: Double posted by accident... someone delete this one.
ssr




PostPosted: Thu Feb 10, 2005 11:30 pm   Post subject: (No subject)

Is it something like that, get the user's input and draw boes?
8) Laughing
hope to be helpful
code:
setscreen ("graphics:1024;768")
var w1, h2, x2, y1 : int
var c : string
put "Enter width of the box for :"
get w1
put "Enter height of the box in pixels:"
get h2
put "Enter x-coordinate of the lower-left corner of the box in pixels:"
get x2
put "Enter y-coordinate of the lower-left corner of the box in pixels:"
get y1
put "enter the character "
get c
cls

for i : 0 .. w1-1
    locate (y1, x2+i)
    put c
    locate (y1 + h2-1, x2+i)
    put c
end for

for i : 1 .. h2-2
    locate (y1+i, x2)
    put c
    locate (y1+i, x2+w1-1)
    put c
end for
Cervantes




PostPosted: Fri Feb 11, 2005 4:20 pm   Post subject: (No subject)

bilal wrote:

to be done in text mode

If you actually mean that, that would mean using View.Set ("text"). None of the code posted so far is in text mode; none of the code posted so far works when put into text mode.
Is that actually what you mean, or do you just mean without using graphics?
bilal




PostPosted: Sat Feb 12, 2005 7:12 pm   Post subject: updated version of make box in text mode

this time it real makes a box but their still some errors, so if you find any errors can you fix it or tell me about it. enter these numbers to make a box "5,10,5,10" in order.

var x1, x2, y1, y2 : int
var c : string
put "Enter width of the box for :"
get x1
put "Enter height of the box in pixels:"
get x2
put "Enter x-coordinate of the lower-left corner of the box in pixels (0-",maxcol,")"
get y1
put "Enter y-coordinate of the lower-left corner of the box in pixels:"
get y2
put "enter the character "
get c
cls
for horiz : x1 .. x2
locate (x2,horiz)
put c..
locate (x1,horiz)
put c..
end for
for width : y1 .. y2
locate (width,y2)
put c..
locate (width,y1)
put c..
end for
Sponsor
Sponsor
Sponsor
sponsor
ssr




PostPosted: Sat Feb 12, 2005 10:19 pm   Post subject: (No subject)

try 4,2,5,6,c it wont really work
and try my code, not in teh text mode, I know, but thats what he meant, I guess, draw boxes in text. 8)
ste_louis26




PostPosted: Wed Feb 23, 2005 7:06 pm   Post subject: (No subject)

u could also use locatexy to do it in pixels and errortrap the range
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  [ 10 Posts ]
Jump to:   


Style:  
Search: