# data[].attributes.body
#include<iostream>
#include<cstdlib>
#include<ctime>

using namespace std;

int main(){
srand( time(NULL) );
int x[6];
for(int i=0; i<6; i++){
x[i] =rand()%100+1;
if(x[i]%2){
x[i]++;

}
}
for(int i=0; i<6; i++){

cout<<x[i]<<" ";
}
}

# data[].attributes.body
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
srand( time(NULL) );
int result[6];
for(int i=0; i<6; i++){
result[i] =rand()%49+1;
}

cout << "排序前的亂數: ";
for(int i=0; i<6; i++){
cout<<result[i]<<" ";
}
sort(result, result+6);
cout << endl << "排序後的數組：";
for (int i = 0; i < 6; i++) {
cout << result[i] << " ";
}
return 0;

}

# data[].attributes.body
#include <iostream>
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
srand( time(NULL) );
int result[6];
for(int i=0; i<6; i++){
result[i] =rand()%49+1;
int number =  result[i];
for (int j = 0; j < i; j++) {
if (number == result[j]) {
i--;
}
}
}
cout << "排序前的亂數: ";
for(int i=0; i<6; i++){
cout<<result[i]<<" ";
}
sort(result, result+6);
cout << endl << "排序後的數組：";
for (int i = 0; i < 6; i++) {
cout << result[i] << " ";
}
return 0;

}

# data[].attributes.body
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
srand( time(NULL) );
int result[6];
cout << "需要抽出幾期號碼?";
int n; cin >> n;
for (int k=1; k<=n; k++){
for(int i=0; i<6; i++){
result[i] =rand()%49+1;
int number =  result[i];
for (int j = 0; j < i; j++) {
if (number == result[j]) {
i--;
}
}
}
sort(result, result+6);
cout << "第" << k << "期: ";
for (int i = 0; i < 6; i++) {
cout << result[i] << " ";
}
cout << endl;
}
return 0;

}

# data[].attributes.headline
<加上特別號 / 查詢期別>

# data[].attributes.subject
<加上特別號 / 查詢期別>

# data[].attributes.body
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
srand(time(NULL));
int result[7], a[7];
cout << "已抽十期，要查詢第幾期?" << endl;
int n; cin >> n;
for(int k=1; k<=10; k++){
for(int i=0; i<7; i++){
result[i] = rand()%49+1;
result陣列
for(int j=0; j<i; j++){
if(result[i]==result[i-j-1]){
i--;
}
}
}
sort (result, result+6);
cout << "第" << k << "期: ";
for(int i=0; i<6; i++){
cout << result[i] << " ";
}
cout << "  特別號: " << result[6] << endl;
if(k==n){
for(int p=0; p<7; p++){
a[p]=result[p];
}
}
}
cout << endl << "查詢結果: ";
for(int i=0; i<6; i++){
cout << a[i] << " ";
}
cout << "  特別號: " << a[6];
}

# data[].attributes.headline
<單一期別/號碼的對獎>

# data[].attributes.subject
<單一期別/號碼的對獎>

# data[].attributes.body
#include <iostream>
using namespace std;

int main()
{
srand(time(NULL));
int result[10][7];
bool b = false;
string YN = "Y";
for(int k=1; k<=10; k++){
for(int i=0; i<7; i++){
result[k][i] = rand()%49+1;
for(int j=0; j<i; j++){
if(result[k][i]==result[k][i-j-1]){
i--;
}
}
}
for (int q = 0; q < 5; q++) {
for (int w = 0; w < 5 - q; w++) {
if (result[k][w] > result[k][w + 1]) swap(result[k][w], result[k][w + 1]);
}
}
cout << "第" << k << "期: ";
for(int i=0; i<6; i++){
cout << result[k][i] << " ";
}
cout << "  特別號: " << result[k][6] << endl;
}
cout << "已抽十期，要查詢第幾期?" << endl;
int n; cin >> n;
cout << "要查詢哪個號碼?" << endl;
int number; cin >> number;
while(YN=="Y"){
for(int i=0; i<7; i++){
if(number == result[n][i]) b = true;
}
if(b==true){
cout << "中獎了!!是否要繼續查詢（Ｙ(繼續)/Ｎ(結束)）?" << endl;
b = false;
cin >> YN;
if(YN=="Y"){
cout << "要查詢第幾期?" << endl;
cin >> n;
cout << "要查詢哪個號碼?" << endl;
cin >> number;
}else{
YN = "N";
}
}else{
cout << "可惜沒中，是否要繼續查詢（Ｙ(繼續)/Ｎ(結束)）?" << endl;
cin >> YN;
if(YN=="Y"){
cout << "要查詢第幾期?" << endl;
cin >> n;
cout << "要查詢哪個號碼?" << endl;
cin >> number;
}else{
YN = "N";
}
}
}
}