圣诞树

昨晚闲无事,写的一个圣诞树!呵呵!很简单!记个笔记吧!

 

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication3
{
    
class Program
    {
        
static void Main(string[] args)
        {
            
string strLevel = Console.ReadLine();
            Program ss 
= new Program();
            ss.PrintHappy(
int.Parse(strLevel));
            Console.ReadKey();
        }

        
private String PrintS(string  C,int intCount)
        { 
            
return intCount<=0?"":PrintS(C,intCount-1)+C;
        }

        
private void PrintLineString(int intC1,int intC2)
        {
            Console.WriteLine(PrintS(
" ", intC1).ToString() + PrintS("*", intC2).ToString());
        }
            
        
private void PrintHappy(int intLevel)
        {
            
for (int i = intLevel,j=10 <i ; i--,j+=2)
            {
                PrintLineString(i, j);
            }
            PrintLineString(intLevel
-11);
        }
             
    }
}
posted @ 2008-12-26 10:32  TONYBINLJ  阅读(196)  评论(0编辑  收藏  举报