公告版位
星落的瞬間!放棄的後悔是永遠!

目前日期文章:200901 (17)

瀏覽方式: 標題列表 簡短摘要
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀

還是kanon(2006)最經典,
驚爆校園危機一樣最好笑,
君吻是校園戀愛中感覺最好的!


讓地獄深紅的天亮 發表在 痞客邦 PIXNET 留言(0) 人氣()

  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀

// C RunTime 標頭檔

#include <stdlib.h>

#include <iostream>

#include <time.h>

#include <string.h>

 

//撲克牌結構

typedef struct {

    char suit[10];

    int face;

讓地獄深紅的天亮 發表在 痞客邦 PIXNET 留言(0) 人氣()

// C RunTime 標頭檔 #include <stdlib.h> #include <iostream> #include <time.h> #include <string.h> //撲克牌結構 typedef struct { char suit[10]; int face; }pockcard; //玩家結構 typedef struct { char name[20]; int value; int win; pockcard card[2]; }player;//副程式 //交換牌 void swap(pockcard pock[52],int a, int b);//拿一付新牌 void TakeNew(int iDeck[][13],pockcard pock[52]);//洗牌 void wash(pockcard pock[52]);//亮出所有牌 void show(int iDeck[][13], const char *ccFace[],pockcard pock[52]);//亮每個人的牌 void showEachone(player *Pman,int iPeoplenum, const char *ccFace[]);//發牌 int shffle(player *Pman, int iPeoplenum,pockcard *pock,int now);//算分 int countgrade(player *Pman, int iPeoplenum); //主程式 int main() { using namespace std; const char *face[13]={"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"}; int iPeoplenum,t,now = 0; int pockpie[4][13] = {0}; char ch = '\0'; pockcard pock[52] = {0}; cout << "How many people want to play?:> "; cin >> iPeoplenum; //得到人數 player *PM = new player[iPeoplenum]; //初始化每個人的資料 for (int i = 0;i < iPeoplenum;i++) { cout << "Player" << i + 1 << "'s name:>"; cin >> PM[i].name; PM[i].value = 0; PM[i].win = 0; } srand(time(0)); //拿一付新牌 TakeNew(pockpie, pock); //洗牌 wash(pock); //亮出所有牌 show(pockpie, face, pock); printf("\n\n"); for (;ch != 'n';) { //發牌 now = shffle(PM, iPeoplenum, pock ,now); cout << "=============================\n"; //亮每個人的牌 showEachone(PM, iPeoplenum, face); t = countgrade(PM, iPeoplenum); //輸出這回合的成績 cout << PM[t].name << " win!\n"; for (int i = 0;i < iPeoplenum;i++) cout << PM[i].name << " has " << PM[i].value << " value. "; cout << "\n"; for (int i = 0;i < iPeoplenum;i++) printf("%5s : %3d\n",PM[i].name,PM[i].win); //看牌用完了沒?來繼續 if (!(now + iPeoplenum*2 < 53)) { now = 0; //洗牌 wash(pock); //亮牌 show(pockpie, face, pock); printf("\n\n"); } for (int i = 0;i < iPeoplenum;i++) PM[i].value = 0; cout << "Play again?(y/n):"; cin >> ch; } system("PAUSE"); return 0; } /拿一付新牌void TakeNew(int iDeck[][13],pockcard pock[52]) { int row, column, card = 0; //照順序做出張牌 for (row = 0;row < 4;row++) { for (column = 0;column < 13;column++) { ++card; switch (row) { case 0: strcpy(pock[row*13+column].suit,"Spades"); pock[row*13+column].face = column; break; case 1: strcpy(pock[row*13+column].suit,"Hearts"); pock[row*13+column].face = column; break; case 2: strcpy(pock[row*13+column].suit,"Diamonds"); pock[row*13+column].face = column; break; case 3: strcpy(pock[row*13+column].suit,"Clubs"); pock[row*13+column].face = column; break; } iDeck[row][column] = card; } } }//洗牌 oid wash(pockcard *pock) { int r1, r2; //取兩個數字交換做次 for (int times= 0; times < 100; times++) { r1 = rand() % 52; r2 = rand() % 52; swap(pock,r1,r2); } }//亮出所有牌 void show(int iDeck[][13], const char *ccFace[],pockcard pock[52]) { int card, g = 0; //從結構中取牌,把張牌依序亮出 for (card = 0; card < 52; card++) { ++g; printf("%2d : %2s of %s\n",g, ccFace[pock[card].face],pock[card].suit); } }/發牌int shffle(player Pman[], int iPeoplenum,pockcard *pock,int now) { int j = 0; for (int i = now;i < now + iPeoplenum * 2;i++) { Pman[j].card[0] = pock[i]; ++i; Pman[j].card[1] = pock[i]; ++j; } return now + iPeoplenum * 2; }//亮每個人的牌 void showEachone(player *Pman,int iPeoplenum, const char *ccFace[]) { int g = 0; ; for (int i = 0;i < iPeoplenum;i++) { std::cout << Pman[i].name << "'s card :" << "\n"; printf("1: %2s of %s ",ccFace[Pman[i].card[0].face],Pman[i].card[0].suit); printf("2: %2s of %s\n",ccFace[Pman[i].card[1].face],Pman[i].card[1].suit); } }//算分 int countgrade(player *Pman, int iPeoplenum) { int max,index = 0,i; for (i = 0;i < iPeoplenum;i++) { if (0 == Pman[i].card[0].face) Pman[i].value += 14; else Pman[i].value += (Pman[i].card[0].face+1); if (0 == Pman[i].card[1].face) Pman[i].value += 14; else Pman[i].value += (Pman[i].card[1].face+1); } max = Pman[0].value; for (i = 0;i < iPeoplenum;i++) if (max < Pman[i].value) { max = Pman[i].value; index = i; } Pman[index].win++; return index; }//交換牌 void swap(pockcard pock[52],int a, int b) { pockcard t = pock[a]; pock[a] = pock[b]; pock[b] = t; }

讓地獄深紅的天亮 發表在 痞客邦 PIXNET 留言(0) 人氣()

  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀
  • 這是一篇限定好友觀看的文章,若您為好友請先登入才可閱讀