while巢狀迴圈 數字三角形

#include 
#include 
#include  
using namespace std;

int main(int argc, char *argv[])
{
 
 int outer = 0;

 while (outer++ <= 4)
 {
  int inner = 0;
  while (inner++ < outer)
  {
   cout << setw(3) << inner;
  }
  cout << endl;
 }
 
 system("PAUSE");
 return EXIT_SUCCESS;
}

這個網誌中的熱門文章

使用memset加快二維陣列初始

TCGS b004: 一個都不能少

UVA Q11614 - Etruscan Warriors Never Play Chess