Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Ngày nghỉ thấy đọan CODE này thú vị chia sẻ mọi người cùng xem
// game.cpp : Defines the entry point for the console application.//
#include "stdafx.h"
#include "Cardgame.h"
#include <iostream>
using namespace std;
int
Cardgame::totalparticipants = 0;
int
_tmain(int argc, _TCHAR* argv[])
{
Cardgame *bridge = 0;
Cardgame *blackjack = 0;
Cardgame *solitaire = 0;
Cardgame *poker = 0;
bridge =
new Cardgame(4);
blackjack =
new Cardgame(8);
solitaire =
new Cardgame(1);
delete blackjack;
delete bridge;
poker =
new Cardgame(5);
delete solitaire;
delete poker;
char *mystring = "0";
cin >> mystring;
return 0;
}
// end game.cpp
//Cardgame.h
#pragma
once
class
Cardgame
{
int players;
staticint totalparticipants;
public
:
Cardgame(
int p);
~Cardgame(
void);
};
//end Cardgame.h
//begin Cardgame.cpp
#include
"StdAfx.h"
#include
"Cardgame.h"
#include
<iostream>
using
namespace std;
Cardgame::Cardgame(
int p)
{
players = p;
totalparticipants += p;
cout << p <<
" players have started a new game. There are now " << totalparticipants << " players in total." << endl;
}
Cardgame::~Cardgame(
void)
{
}
// end Cardgame.cpp
Comments
- Anonymous
February 14, 2009
PingBack from http://www.clickandsolve.com/?p=8148