1. 程式人生 > >showlong 專欄「C++」@ http://www.fuel4d.com

showlong 專欄「C++」@ http://www.fuel4d.com

#define __str _T("***********************************************************************************************")
#define __spc _T("                                                                                               ")

void _ptr(int start, int now, int count)
{
 int num = start + (count<<1);
 if (now < num)
 {
  printf("%.*s%.*s/n", (num - now)>>1, __spc, now, __str);
  _ptr(start, now + 2, count);
 }
}

呼叫方法:

int RunApp()
{
 _ptr(1, 1, 10);// 第一個引數應和第二個引數一樣,意思是第一行顯示多少個..第三個引數為總行數
 return 0;
}