楼主: 
dritchie (卍~迈斯纳效应~卍)   
2015-12-15 21:59:46#include<iostream>
#include<string>
using namespace std;
template<int N>string Space(){return " "+Space<N-1>();}
template<>string Space<0>(){return "";}
template<int N>string Star(){return "*"+Star<N-1>();}
template<>string Star<0>(){return "";}
int main()
{
    cout<<Space<2>()<<Star<2>()<<endl;
    cout<<Space<1>()<<Star<4>()<<endl;
    cout<<Space<0>()<<Star<6>()<<endl;
}
※ 引述《djljing (娱乐金鱼眼)》之铭言:
: ※ 引述《magic704226 (梅姬?没鸡?傻傻分不清楚)》之铭言:
: : #include <stdio.h>
: : #include <stdlib.h>
: : int main()
: : {
: :     int i,j;
: :     for(i=2;i<=6;i+=2)
: :     {
: :        for(j=1;j<=(6-i)/2;j++) printf(" ");
: :        for(j=1;j<=i;j++) printf("*");
: :        printf("\n");
: :     }
: :     system("pause");
: :     return 0;
: : }
: 自己写出来了,只能说magic704266是高手
: #include<stdio.h>
: #include<stdlib.h>
: int main(void)
: {
:    int i,j,k;
:     for(i=1;i<=3;i++)
:     {
:      for(k=3;k>=i;k
作者: yvb   2015-12-18 14:13:00
画方形可以复制贴上,画三角形光靠复制贴上可能还不行呀.