Hello,
I want my program to be like this:
http://i61.tinypic.com/ogjjio.jpg
so what should I add? or where should I add the space?!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include<iostream>
using namespace std;
void DrawBox (char, int, int); // Prototype
int main ()
{
char letter = '&';
DrawBox(letter, 4, 2*3); // Function call
return 0;
}
void DrawBox(char what, int down, int across)
// 3 parameters
{
int row, col; // 2 local variables
for (row = 0; row < down; row++)
{
for (col = 0; col < across; col++)
{
if ((row>0)&&(row<3)&&(col>0)&&(col<5))
continue;
cout <<what;
}
cout << endl;
}
return;
}
|
Last edited on
Solution~
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
void DrawBox (char, int, int); // Prototype
int main ()
{
char letter = '&';
DrawBox(letter, 4, 2*3); // Function call
return 0;
}
void DrawBox(char what, int down, int across)
// 3 parameters
{
int row, col; // 2 local variables
for (row = 0; row < down; row++)
{
for (col = 0; col < across; col++)
{
if ((row>0)&&(row<3)&&(col>0)&&(col<5))
{ //just adding whitespace here
cout<<" ";
continue;
}
cout <<what;
}
cout << endl;
}
return;
}
|
PS: please use code tags
Last edited on
Thank you for the solution! and sorry! Used the code tags!