社区讨论
徵羽摩柯真可爱
灌水区参与者 26已保存回复 30
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 30 条
- 当前快照
- 1 份
- 快照标识符
- @lqgn10pm
- 此快照首次捕获于
- 2023/12/22 20:58 2 年前
- 此快照最后确认于
- 2025/11/21 00:17 4 个月前
有人能把视频中的代码出成题目么?
代码如下(orzB站评论区大佬):
CPP#include<iostream>
using namespace std;
/*This is my first c++ program.
Auther:ZhiyuMoke
Date:2018.5.30
*/
void PrintDiamond(int n)
{
int i, j;
for (i = 0; i<n; i++)
{
for (j = 0; j <= n - i; j++)
cout << " ";
for (j = 0; j<(2 * i - 1); j++)
cout << "*";
cout << endl;
}
for (i = 0; i<n; i++)
{
for (j = 0; j <= i; j++)
cout << " ";
for (j = 0; j<(2 * (n - i) - 1); j++)
cout << "*";
cout << endl;
}
}
int main()
{
PrintDiamond(4);
cout << "Hello World!!";
PrintDiamond(4);
return 0;
}
把PrintDiamond(4)改成(n)
10% n<=4;
20% n<=8;
30% n<=10;
50% n<=100;
90% n<=500;
100% n<=1000;
回复
共 30 条回复,欢迎继续交流。
正在加载回复...