输出如下图案(第一行星号前面有 4 个空格,后面每行星号前面的空格数比前一行少一个),下列代码中的下划线处应填写的语句是( )
* * * * *
cpp复制1int n = 5; 2for (int i = 1; i <= n; i++) 3{ 4 for (int j = 1; j <= n - i; j++) 5 cout << " "; // 2个空格 6 _________________________ 7 { 8 if(j == 1) 9 cout << "*"; 10 else 11 cout << " *"; // 1个空格 12 } 13 cout << endl; 14}
1int n = 5; 2for (int i = 1; i <= n; i++) 3{ 4 for (int j = 1; j <= n - i; j++) 5 cout << " "; // 2个空格 6 _________________________ 7 { 8 if(j == 1) 9 cout << "*"; 10 else 11 cout << " *"; // 1个空格 12 } 13 cout << endl; 14}
for(int j = 1; j <= 2 * i + 3; j++)
for(int j = 1; j <= i + 4; j++)
for(int j = 1; j <= i + 3; j++)
for(int j = 1; j <= 2 * i + 2; j++)