How can i draw a 1 line border or frame around code using an " * " , searching the net i have seen techniques using loops and various functions but i cant grasp the concepts being used, even a link to a indept tut on this would be a great help.

Recommended Answers

All 5 Replies

If you do not understand the concept of loops then no tutorial on drawing borders is going to help. Perhaps you should start by trying to use a loop to draw a straight line of a given size. From there, you can begin to extend your approach to multiple nested loops.

Try this :

for ( int i = 0; i < 10 ; i++ )
{
   cout<< "*" ;
}

It creates a border like this:
**********

Similarly for vertical part use a cout<<endl so that after printing a star you can move to next line. Try it.

thanks for the feedback

i agree buit i am not completely oblivious to the concept loops but a tutorial would help me i have done calulations using loops but not anything remotely close to drawing a border...
if you know of any please post a link

i did a little bit of reading up and practicing

for (int i=o; i<10; i++)
{

for (int a=o; a<10; a++)
   {
   printf("*");
   }

printf("*/n");
}

i know i need to fill this out with some if statements as i was reading a previous thread of a similar topic but then how would output statemetns be written within a box using nested for-loops and if else statements?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.