Click here to Skip to main content
15,922,007 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Closing a dialog app window Pin
Ravi Bhavnani7-Jul-05 10:26
professionalRavi Bhavnani7-Jul-05 10:26 
GeneralRe: Closing a dialog app window Pin
PJ Arends7-Jul-05 10:49
professionalPJ Arends7-Jul-05 10:49 
GeneralTranslation Tool Pin
transoft7-Jul-05 8:28
transoft7-Jul-05 8:28 
GeneralRe: Translation Tool Pin
Ravi Bhavnani7-Jul-05 10:28
professionalRavi Bhavnani7-Jul-05 10:28 
Generala poker game....need help......plz help Pin
koalacui7-Jul-05 7:55
koalacui7-Jul-05 7:55 
GeneralRe: a poker game....need help......plz help Pin
David Crow7-Jul-05 8:06
David Crow7-Jul-05 8:06 
GeneralRe: a poker game....need help......plz help Pin
koalacui7-Jul-05 8:11
koalacui7-Jul-05 8:11 
GeneralI have done so far..............help me update Pin
koalacui7-Jul-05 8:13
koalacui7-Jul-05 8:13 
#include <iostream>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <conio.h>
using namespace std;
void print_balance( int ) ;
void print_result( int ) ;
void Print_Cards_At_Hand ( void ) ;
void Check_Winning ( void ) ;
int draw_Card( void ) ;

int deck[52] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73 } ;


void main( void )
{
srand (time (0));
int balance = 100 ;
int bet = 0 ;

while( balance > 0 )
{
balance = balance - bet;

print_balance( balance ) ;
cout << endl ;

if (balance != 0)
{
do
{
cout << "Please enter the amount to bid: $" ;
cin >> bet ;

if( bet > balance )
{
cout << "ALERT! You do not have enough " << "to bet $" << bet << endl ;
}

cout << endl ;

}while( bet > balance || bet == 0) ;

Print_Cards_At_Hand();
cout << endl ;
}

}


} // main()

void print_balance( int balance )
{

cout << "========================================" << endl;
cout << "Your current balance is $" << balance << " dollars" ;
cout << endl ;

if( balance <= 0 )
{
cout << "You are bankrupted" ;
cout << endl;
}
cout << "========================================" << endl;
}

void print_result( int winning_amt )
{
cout << "== Winning Result ======================" << endl;

if( winning_amt > 0 )
{


cout << "You have won " << winning_amt << "dollars."
<< endl ;
}
else
{


cout << "Sorry, you have not won anything." << endl ;
cout << "You have lost $" << winning_amt << " dollars." ;
}

cout << "========================================" << endl;
}

int draw_Card( void )
{
int c = (rand() % 52) ;

return c;
}


void Print_Cards_At_Hand ( void )
{
int i;
int x;
int y;
int number[6];
int identity[6];
int value[6];
string type;



for (i=1;i<6;i++)
{
cout << "Press [ENTER] to draw your " << i << " card ... " << endl;

while (_getch() !=13)
{}

cout << "-- Your Cards on hand ------------------" << endl;

int card_index = draw_Card();

y = deck[card_index]/20;

if( y == 0 )
{
identity[i] = 1;
value[i] = deck[card_index];
number[i] = deck[card_index];
}
else if( y == 1 )
{
identity[i] = 2;
value[i] = deck[card_index];
number[i] = deck[card_index] - 20;
}
else if( y == 2 )
{
identity[i] = 3;
value[i] = deck[card_index];
number[i] = deck[card_index] - 40;
}
else
{
identity[i] = 4;
value[i] = deck[card_index];
number[i] = deck[card_index] - 60;
}


for (x=1;x<=i;x++)
{
if ( identity[x] == 1 )
{
cout << "- " << number[x] << " of Diamonds" << " ("<< value[x] << ")"<< endl;
}
else if ( identity[x] == 2 )
{
cout << "- " << number[x] << " of Clubs" << " ("<< value[x] << ")"<< endl;
}
else if ( identity[x] == 3 )
{
cout << "- " << number[x] << " of Hearts" << " ("<< value[x] << ")"<< endl;
}
else
{
cout << "- " << number[x] << " of Spades" << " ("<< value[x] << ")"<< endl;
}

}

}


}

void Check_Winning ( void )
{


}
QuestionHow to check folder last access time? Pin
MirkoMax7-Jul-05 7:39
sussMirkoMax7-Jul-05 7:39 
AnswerRe: How to check folder last access time? Pin
David Crow7-Jul-05 7:48
David Crow7-Jul-05 7:48 
Generalcheckbox check problem Pin
c. s.7-Jul-05 7:11
c. s.7-Jul-05 7:11 
GeneralRe: checkbox check problem Pin
David Crow7-Jul-05 7:32
David Crow7-Jul-05 7:32 
GeneralRe: checkbox check problem Pin
c. s.7-Jul-05 7:49
c. s.7-Jul-05 7:49 
GeneralRe: checkbox check problem Pin
David Crow7-Jul-05 8:02
David Crow7-Jul-05 8:02 
GeneralRe: checkbox check problem Pin
c. s.7-Jul-05 8:09
c. s.7-Jul-05 8:09 
GeneralRe: checkbox check problem Pin
David Crow7-Jul-05 8:14
David Crow7-Jul-05 8:14 
GeneralRe: checkbox check problem Pin
Jose Lamas Rios7-Jul-05 8:08
Jose Lamas Rios7-Jul-05 8:08 
GeneralRe: checkbox check problem Pin
David Crow7-Jul-05 8:15
David Crow7-Jul-05 8:15 
GeneralRe: checkbox check problem Pin
Jose Lamas Rios7-Jul-05 8:20
Jose Lamas Rios7-Jul-05 8:20 
GeneralRe: checkbox check problem Pin
c. s.7-Jul-05 8:18
c. s.7-Jul-05 8:18 
GeneralRe: checkbox check problem Pin
Jose Lamas Rios7-Jul-05 8:40
Jose Lamas Rios7-Jul-05 8:40 
GeneralScroll Messages from ListCtrl Pin
Jethro637-Jul-05 7:08
Jethro637-Jul-05 7:08 
GeneralRe: Scroll Messages from ListCtrl Pin
Jose Lamas Rios7-Jul-05 8:13
Jose Lamas Rios7-Jul-05 8:13 
GeneralRe: Scroll Messages from ListCtrl Pin
Jethro637-Jul-05 9:52
Jethro637-Jul-05 9:52 
GeneralRe: Scroll Messages from ListCtrl Pin
Jose Lamas Rios7-Jul-05 10:05
Jose Lamas Rios7-Jul-05 10:05 

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.