menu Andy's Blog
more_vert
元胞自动机C语言版
2020-04-26 | 日常 | 暂无评论 | 1784 次阅读 | 56字
Andy
author

不废话,看看效果。
来嘞,孩子们

emm,之前那个是Python完整版,而下面还有改进的微缩版本!

#include<iostream>
using namespace std;
int main(){
    //金字塔
    int n;
    cin >>n;
    for(int i=1;i<=n;i++){
        //j可以表示空格 
        for(int j=1;j<=n-i;j++){
            cout <<" ";
        }
        //k表示* 
        for(int k=1;k<=2*i-1;k++){
            cout <<"*";
        }
        cout <<endl;
    } 
    
    return 0;
}

感谢阅读(估计就我自己看) ::(滑稽)

None
发表评论
暂无评论
textsms
account_circle
email
link