# 第六周 重複敘述 while
while 迴圈與 for 迴圈雖然同為常見的迴圈,但for 迴圈有明確的初始值、執行條件,因此可以明確知道 for 迴圈被執行幾次,簡單來說 for迴圈有明確的執行次數上限,而 while 迴圈會不斷直行至有人中止

## 練習
說明:每次抽10個介於1~10之間的號碼牌,若有5張以上的號碼牌大於5即可再抽一次
```cpp=
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
time_t t;
int v; //儲存亂數產生的值
int num; //亂數大於5的個數
int no = 0; //執行第幾次
//產生亂數種子
srand((unsigned)time(&t));
do
{
num = 0;
no++;
cout << "第 " << no << " 次:";
for (int i = 0; i < 10; i++)
{
v = (rand()%10)+1;
cout << v << ", ";
if (v > 5)
num++;
}
cout << endl;
} while (num > 5);
system("pause");
}
```