write a program that reads in the side of a square and then prints that square
out of asterisks. your program should work for squares of all sides between 1 and 20.
for example , if your program reads a size of 4 , it should print
****
****
****
****作者: 羽德 時間: 06-10-29 23:40
題目是表示 , 打數字1~20 間的一個數字n,印出n*n行的*號 , 這樣嗎??
int x,i,j;
cin>>x;//取得數字
if(x<21&&x>0)
{
i=0;
//印出的行數
while(i<x)
{
j=0;
//印出*數
while(j<x)
{
cout<<"*";
j++;
}
cout<<"\n";
i++;
}
}else{
cout<<"請輸入1~20的數";
}