题目描述

(Square of Asterisks) Write a function that displays at the left margin of the screen a solid square of asterisks whose side is specified in integer parameter side. For example, if side is 4, the function displays the following:

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

输入格式

The input consists of n (0<n<100) lines.
Each line consists of the side length(ranges from 1 to 100).
The last line of input consists of Int(0).


输出格式

Output a solid square of asterisks whose side is specified in integer parameter side for each input side length.


样例数据

输入

1
2
3
4
0

输出

*

**
**

***
***
***

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


备注

The main function is provided, you only need to complete the square function:

#include <iostream>
using namespace std;

void square( int ); // function prototype

int main()
{
   unsigned int side = 0; // input side length
   while (true)
   {
      cin>> side;
      if (side == 0)
         break;
      square( side ); // display solid square of asterisks
      cout << endl;
   }
} // end main

操作

评测记录

优秀代码

信息

时间限制: 1s
内存限制: 128MB
评测模式: Normal

题解