Saturday, February 16, 2013

C++ Programming

Here's a simple C++ problem that deals with basic input and output processing. The solution is straight forward, using while loops, if statements and decrements. 

Problem:
Write a program that reads in the size of the side of a square and then prints a hollow square of that size out of asterisks and blanks. Your program should work for squares of all side sizes between 1 and 20. For example, if your program reads a size of 5, it should print

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

The  solution is in my Github page.

Here's a sample test run




No comments:

Post a Comment