This commit is contained in:
Dengrb 2025-03-01 09:39:21 +08:00
parent 3a354e7234
commit 38b24072f0
3 changed files with 50 additions and 2 deletions

View File

@ -13,7 +13,6 @@ int main(){
{ {
cout <<"456"<<endl; cout <<"456"<<endl;
} }
} }
return 0; return 0;

27
zheng_san_jiao_xin.cpp Normal file
View File

@ -0,0 +1,27 @@
//正三角形
#include<iostream>
#include<windows.h>
using namespace std;
int main(){
int n;
cin >>n;
for (int i = 1; i <= n; i++)
{
for (int y = 1; y <= n-i; ++y)
{
cout <<" ";
}
for (int j = 1; j <= 2*i-1; ++j)
{
cout <<"*";
}
cout <<endl;
}
//Sleep(1000000000);
return 0;
}

22
zhi_jiao_san_jiao_cin.cpp Normal file
View File

@ -0,0 +1,22 @@
//直角三角形
#include<iostream>
#include<string>
using namespace std;
int main(){
int n;
cin >>n;
string xin = "*";
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= i; ++j)
{
cout <<xin;
}
cout <<endl;
}
return 0;
}