- C++
0316周六信奥上午班-作业
- 2024-3-16 11:07:27 @
3 条评论
-
mrhowe SU @ 2024-3-23 11:21:32
打印指定字符
#include<bits/stdc++.h> using namespace std; int main(){ int n,m,a; char ch; cin>>n>>m>>ch>>a; for(int i=1;i<=m;i++){ if(a==0){ if(i==1||i==m){ for(int j=1;j<=n;j++)cout<<ch; }else{ cout<<ch; for(int j=1;j<=n-2;j++)cout<<" "; cout<<ch; } }else{ for(int j=1;j<=n;j++)cout<<ch; } cout<<endl; } return 0; }
-
2024-3-23 11:20:55@
#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 j=1;j<=2*i-1;j++){ cout<<"*"; } cout<<endl; } for(int i=1;i<=n;i++){ // 空格 for(int j=1;j<=i;j++){ cout<<" "; } // * for(int j=1;j<=n-i;j++){ cout<<"*"; } for(int j=1;j<=n-i-1;j++){ cout<<"*"; } cout<<endl; } return 0; }
-
2024-3-16 16:41:01@
第一题:
第二题:
第三题:
- 1