|
Post by huangno1 on Feb 25, 2017 6:31:17 GMT -8
程式說明
練習撰寫單參數與多參數的函式。
題目敘述
請完成函式 PrintSquare(),當呼叫 PrintSquare(3, 2) 時,會列印出
**
**
**
#include <stdio.h>
void PrintStar(int num)
{
for (int i=0; i<num; i+=1)
printf("*");
}
void PrintSquare( int row , int col )
{
for (int r=0; r< row ; r+=1)
{
PrintStar( col );
printf ( "\n" ) ;
}
}
int main()
{
int row = 0, col = 0;
scanf("%d%d", &row, &col);
PrintSquare( row , col );
return 0;
}
|
|