Click here to Skip to main content
15,913,685 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: about MCIERROR err = mciSendCommand(....) function Pin
kakan3-Jan-07 2:22
professionalkakan3-Jan-07 2:22 
AnswerRe: about MCIERROR err = mciSendCommand(....) function Pin
Mark Salsbery3-Jan-07 7:24
Mark Salsbery3-Jan-07 7:24 
GeneralRe: about MCIERROR err = mciSendCommand(....) function [modified] Pin
Raja Bose C Leo4-Jan-07 0:34
Raja Bose C Leo4-Jan-07 0:34 
GeneralRe: about MCIERROR err = mciSendCommand(....) function Pin
Mark Salsbery4-Jan-07 5:10
Mark Salsbery4-Jan-07 5:10 
AnswerRe: about MCIERROR err = mciSendCommand(....) function Pin
Hamid_RT3-Jan-07 17:48
Hamid_RT3-Jan-07 17:48 
Questionstore certain amount of total number Pin
davvid2-Jan-07 19:02
davvid2-Jan-07 19:02 
AnswerRe: store certain amount of total number Pin
Christian Graus2-Jan-07 19:12
protectorChristian Graus2-Jan-07 19:12 
GeneralRe: store certain amount of total number Pin
davvid2-Jan-07 20:10
davvid2-Jan-07 20:10 
Thank for ur reply anyway..
now i can print out total num in the right way.
But i still have problem with how to store all total number of several player.
coz I dont know really the size of array or other.It is depended on the amount of player that user want to play.

here is code:

#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <string>

struct {
char suit;
std::string face;
int value;
}deck[52];

struct {
 const char *face;
 int value;
}cardValues[] = {
  {"2", 2},{"3", 3},{"4", 4},
  {"5", 5},{"6", 6},{"7", 7},
  {"8", 8},{"9", 9},{"10", 10},
  {"J", 13},{"Q", 12},{"K", 11},
  {"A", 1}
};

const char cardSuits[] = {'D','C','H','S'};

int main()
{
using namespace std;
int ur, i = 0;

  // Build the deck
for ( int suit = 0; suit < 4; suit++ ){
    for( int face = 0; face < 13; face++ ){
      deck[i].face = cardValues[face].face;
      deck[i].value = cardValues[face].value;
      deck[i].suit = cardSuits[suit];
      ++i;
    }
  }
	// Shuffle the deck
  srand ( (unsigned int)time(0));
  random_shuffle( deck, deck + 52 );

 // Pop off hands of at most 5 until the deck is empty
  
 //vector<int> v;
 //int scores[n];
 //int hhh[5];
   int n=0;
   cin>>n;//user input for number of player..
	for ( i = 0; i < 3*n; ) {
	int urtotal=0;
	cout << "Hand #" << n<< '\n';
		for ( int j = 0; i < 52 && j < 3; i++, j++ ){
		cout << deck[i].suit << deck[i].face <<" ";
		urtotal+=deck[i].value;
				/*if(urtotal>42)
				urtotal=urtotal-30;
				else if(urtotal>31&&urtotal<42)
				urtotal=urtotal-20;
				else if(urtotal>21&&urtotal<32)
				urtotal=urtotal-10;*/
		}
		
		cout<<urtotal<<endl<<endl;
	//(want to store all the total number)
		}
	
	

	//cin>>ur;
  return 0;
}

GeneralRe: store certain amount of total number Pin
Christian Graus2-Jan-07 22:15
protectorChristian Graus2-Jan-07 22:15 
QuestionCan Custom control with generic CWnd use CScrollView? Pin
cyn82-Jan-07 18:41
cyn82-Jan-07 18:41 
AnswerRe: Can Custom control with generic CWnd use CScrollView? Pin
kasturi_haribabu3-Jan-07 0:19
kasturi_haribabu3-Jan-07 0:19 
AnswerRe: Can Custom control with generic CWnd use CScrollView? Pin
dabs3-Jan-07 3:06
dabs3-Jan-07 3:06 
Questionwhy is connect returning -1? Pin
arbster2-Jan-07 18:38
arbster2-Jan-07 18:38 
AnswerRe: why is connect returning -1? Pin
Richard Andrew x642-Jan-07 18:41
professionalRichard Andrew x642-Jan-07 18:41 
GeneralRe: why is connect returning -1? Pin
arbster2-Jan-07 19:02
arbster2-Jan-07 19:02 
QuestionRe: why is connect returning -1? Pin
prasad_som2-Jan-07 18:44
prasad_som2-Jan-07 18:44 
AnswerRe: why is connect returning -1? Pin
arbster2-Jan-07 18:52
arbster2-Jan-07 18:52 
GeneralRe: why is connect returning -1? Pin
Richard Andrew x642-Jan-07 19:24
professionalRichard Andrew x642-Jan-07 19:24 
QuestionWinsock Connections Pin
Richard Andrew x642-Jan-07 18:16
professionalRichard Andrew x642-Jan-07 18:16 
AnswerRe: Winsock Connections Pin
Richard Andrew x642-Jan-07 18:38
professionalRichard Andrew x642-Jan-07 18:38 
QuestionWow...This is killing me!! Sombody please Help!! Pin
arbster2-Jan-07 16:52
arbster2-Jan-07 16:52 
AnswerRe: Wow...This is killing me!! Sombody please Help!! Pin
prasad_som2-Jan-07 17:12
prasad_som2-Jan-07 17:12 
AnswerRe: Wow...This is killing me!! Sombody please Help!! Pin
bob169722-Jan-07 18:07
bob169722-Jan-07 18:07 
QuestionERROR IN FROM CLAUSE Pin
Shouvik Das2-Jan-07 16:35
Shouvik Das2-Jan-07 16:35 
AnswerRe: ERROR IN FROM CLAUSE Pin
Chris Maunder2-Jan-07 17:28
cofounderChris Maunder2-Jan-07 17:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.