我看了一下c++的练习书上
有一个
让我们打印出一个
梯形
好了上代码!
(跪求赞和评论!!)
(跪求赞和评论!!)
(跪求赞和评论!!)
#include<bits/stdc++.h>
using namespace std;
int main ()
{
int n;
cin>>n;
for(int i = 1;i <=n;i++)
{
for(int j = 1;j <= n-i;j++)
{
cout<<" ";
}
for(int k = 1;k <= 2*i+1;k++)
{
cout<<"*";
}
cout<<endl;
}
return 0;
}
cout也可以用System.out.print()来写的。
一起加油!!