#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

void main()

{
	cout << "猜數字 ─ 請猜 1 ~ 5 之中的隨機數"
		 << endl << endl << endl
		 << "請輸入數字 = ";

	int random01;
	srand(time(NULL));
	random01 = 1 + rand() % (5 - 1 + 1);

	int num01;
	cin >> num01;
    if (num01 == random01)
	{
		cout << endl 
			 << "您好厲害，一猜就中！！！"
			 << endl << endl << endl;
	}
	else
	{
		cout << endl 
			 << "您猜錯了，還有一次機會喔！"
			 << endl << endl
			 << "請輸入數字  = ";  
	    int num02;
		cin >> num02;
		if (num02 == random01)
		{
			cout << endl 
				 << "您猜對了，恭喜！！"
				 << endl << endl << endl;
		}
		else
		{
			cout << endl
				 << "您還是沒猜中...下次加油囉！"
				 << endl << endl << endl;
		}
	}

		system("PAUSE");

}

