> 1 <
| Yazar | Mesaj |
Zeki Burak Ata |
15:57 28-05-2004 GMT+02 saat |
|
Kod: #include<iostream.h>
#include<conio.h> #include<stdlib.h> #include<iomanip.h> #include<ctime> int main() { //srand(time(0)); const char *suit[4]={\"Hearts\",\"Diamonds\",\"Clubs\",\"Spades\"}; const char *face[13]={\"Ace\",\"Deuce\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\",\"Ten\",\"Jack\",\"Queen\",\"King\"}; int deck[4][13]={0},row,column; for(int card=1;card<=52;card++) //shuffling { do { row=rand()%4; column=rand()%13; }while(deck[row][column]!=0); deck[row][column]=card; } //***************************************************** cout<<\"ttttDeal of the cardsn\" //print header <<\"tttt-----------------nn\"; cout<<\"tt1 2 3 4 5 6 7 8 9 10 11 12 13 nn\"; for(int i=0;i<4;i++)//print persons { cout<<\"Person (\"<<i+1<<\") : \"; for(int j=0;j<13;j++) { cout<<setw(4)<< deck[i][j]; } cout<<endl; } cout<<endl<<endl<<endl; getch(); //system(\"CLS\"); //***************************************************** cout<<\"tttNumber of Elements in Each Suitn\" //print header <<\"ttt-------------------------------nn\"; for( i=0;i<4;i++)// finding frequencies of cards for each row { cout<<\"Person (\"<<i+1<<\") : \"; int freq[4]={0}; for(int j=0;j<13;j++) freq[int(float(deck[i][j])/13.32)]++;//I've chosen 13.32,numbers between 1 and 13 /13.32=0. 14 and 26/13.32=1. 27 and 39/13.32=2. and bigger than 39/13.32=3 which are row numbers of deck array and face array index for(int k=0;k<4;k++) cout<<freq[k]<<\" \"<<suit[k]<<\" \"; cout<<endl; } getch(); system(\"CLS\"); //***************************************************** cout<<\"ttCards are printed accordind to Personsn\"//print header <<\"tt--------------------------------------n\"; for( i=0;i<4;i++) { cout<<\"Person (\"<<i+1<<\") : \"<<endl; for(int k=0;k<4;k++) { cout<<suit[k]<<\" : \"; for(int j=0;j<13;j++) { if(k==int(float(deck[i][j])/13.32)) cout<<face[(deck[i][j]-1)%13]<<\" \"; } cout<<endl; } } getch(); system(\"CLS\"); //***************************************************** cout<<\"ttttGame Resultsn\" //print header <<\"tttt-----------nn\"; int score[4]={0}; for( i=0;i<4;i++)//finding scores { cout<<\"Person (\"<<i+1<<\") : \"; for(int j=0;j<13;j++) { if(deck[i][j]%13==10||deck[i][j]%13==11||deck[i][j]%13==12||deck[i][j]%13==0) score[i]+=10; else if(deck[i][j]%13==1) score[i]+=11; else score[i]+=deck[i][j]%13; } cout<<score[i]<<endl; } int max=score[0]; int who=0;//who is the winner for(i=0;i<4;i++)//finding winner { if(max<score[i]) { max=score[i]; who=i; } } cout<<\"Person \"<<who+1<<\" is the winner!\"<<endl; getch(); //system(\"CLS\"); return 0; } |
|
|
In me you trust
|
|
Ercan VAROL |
06:10 02-06-2004 GMT+02 saat |
|
zakkey sen nasıl yaptın bu projeyi?
|
|
|
Ercan VAROL
http://www.ercanvarol.com Taşları delen suyun gücü değil , sürekliliğidir |
|
Ercan VAROL |
06:11 02-06-2004 GMT+02 saat |
|
ya bi de bu ne:\" hesabını kapatmadan kalkma geyiği ne ya\"
|
|
|
Ercan VAROL
http://www.ercanvarol.com Taşları delen suyun gücü değil , sürekliliğidir |
|
Zeki Burak Ata |
18:15 07-06-2004 GMT+02 saat |
|
yasdık ya oraya by mkavici diye.
Alıntı şimdi site engine ninden dolayı sayfayı kapattığınızda log out olamıorsunuz.onun için bisde unutanların profilden hesabı kapatda git diye uyarı yasıos. ama kısa zamanda site yenilenecek bööle sorunlar kalmayacak mrk etme seeen |
|
|
In me you trust
|
> 1 <



