[C++] Drawing a window border with asterisks

A

AMT2K5

Hello, I am just wondering if there is an easy way to do the following
in my constructor

IOScreen(int row, int col, int width, int height); sets the row, col,
width, height attributes of the IOScreen to the corresponding incoming
values in the argument list. If an IOScreen is made using this
constructor, it means that the IOScreen window is not a full-screen
size window. (i.e it will only cover the screen partially and when it
is displayed, it will show a frame using the asterisk character on the
border line characters of the window

I assume Ill want to use my row, col, width and height in some kind of
for loop to make the border line characters of the window but am unsure
of the conditions to do so. Appreciate any help whatsoever.

Thanks in advance.

Edit: Think I forgot to mention that I can use a function I wrote
called cio_cursor

/* Places cursor at specified row/column number */
void cio_cursor(int row, int column);

So far I have got

IOScreen::IOScreen(int row, int col, int width, int height){
this->row = row;
this->col = col;
this->width = width;
this->height = height;
cio_start();
cio_cursor(row,col);
// Adjust window settings for this constructor using width and height
}
 
J

Jim Langston

AMT2K5 said:
Hello, I am just wondering if there is an easy way to do the following
in my constructor

IOScreen(int row, int col, int width, int height); sets the row, col,
width, height attributes of the IOScreen to the corresponding incoming
values in the argument list. If an IOScreen is made using this
constructor, it means that the IOScreen window is not a full-screen
size window. (i.e it will only cover the screen partially and when it
is displayed, it will show a frame using the asterisk character on the
border line characters of the window

I assume Ill want to use my row, col, width and height in some kind of
for loop to make the border line characters of the window but am unsure
of the conditions to do so. Appreciate any help whatsoever.

Thanks in advance.

Edit: Think I forgot to mention that I can use a function I wrote
called cio_cursor

/* Places cursor at specified row/column number */
void cio_cursor(int row, int column);

So far I have got

IOScreen::IOScreen(int row, int col, int width, int height){
this->row = row;
this->col = col;
this->width = width;
this->height = height;
cio_start();
cio_cursor(row,col);
// Adjust window settings for this constructor using width and height
}

Well, an asterisk box would look like:

******
* *
* *
******

So you just got to position to each of the asterisk positions and print a
'*'.
For the top and bottom you can build a string of "******" and just print
that if you want.

Otherwise, do a for loop for the first line for each asterisk, position to
that row at the top column, print an asterisk. Then for each other line
print an "*" in the left position and one in the right.
Then do the same thing you did for the top line for the bottom line.

I'm purposly being vague because I suspect this is homework. Also consider
the newsgroup alt.comp.lang.learn.c-c++
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top