→ ck940560:做個\b的動畫會比較好@@ 單純花俏路線 11/18 14:39
#include <iostream>
#include <iomanip>
#include <ctime>
using namespace std;
int loto_number();
int main()
{
srand(time(NULL));
int loto[7];
for(int i=0;i<7;i++)
{
loto[i] = loto_number();
for(int j=0;j<i;j++)
{
if(loto[i]==loto[j])
loto[i] = loto_number();
}
if(i==6)
cout << "特別號:";
cout << setw(2) << loto[i] << " ";
}
system("pause");
return 0;
}
int loto_number()
{
int number = rand()%42+1;
return number;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.7.59