Answer to Question #27918 in C++ for red rose

Question #27918
Modify the function created in question 6 above to form the square out of whatever character is contained in character parameter fillCharacter. Thus, if side is 5 and fillCharacter is #, then this function should print the following:


#####

#####

#####

#####

#####
1
Expert's answer
2013-04-09T08:37:20-0400
#include <iostream>

using namespace std;

void print_square(int size, char fillCharacter)
{
for (int x = 0; x < size; x++)
{
for (int y = 0; y < size; y++)
cout << fillCharacter;
cout << endl;
}
}

int main()
{
print_square(5, '#');
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS