By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,486 Members | 1,696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,486 IT Pros & Developers. It's quick & easy.

[C++] Drawing a window border with asterisks

P: n/a
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
}

Nov 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"AMT2K5" <Aa*********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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++
Nov 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.