Card game (E-card)

This game is from an anime and the player has to bet in millimeters. There are 2 sides here, the emperor and slave side, with the emperor, 1 millimeter is equal to 100000, while with the slave, 1 millimeter is equal to 500000. I need help with the initialization of my references, and my expressions to be a modifiable Ivalue. Thank you.

#include <iostream>
#include <string>
using namespace std;

int&d; //emperor
int&e; //slave
int&r; //citizen
int&c; //emperor round
int&f; //slave round

void printEmperorRound(int size, int index, int&f) // Creates a round for Kaiji in the emperor side
{
int c[6] = { 0,1,2,6,7,8, };

system("pause");
}

void printSlaveRound(int size, int index) //Creates a round for Kaiji in the slave side
{
int f[6] = { 3,4,5,9,10,11 };
system("pause");
}

void printCards(int size, int index) // Generates 4 Citizen cards (r) and a 50 - 50 chance for an Emperor (d) or Slave card (e)
{
if (r = 4, r <= 4, r++)
{
d; // emperor
}
else
{
e; // slave
}
system("paused");
cout << d || e; // draws an emperor or slave card
cout << r << "Citizen" << endl;
cout << r << "Citizen" << endl;
cout << r << "Citizen" << endl;
cout << r << "Citizen" << endl;


if (d<e) //citizen versus citizen is a tie
{
return; // emperor loses to slave
}
else
{
d > r = true; //emperor wins over citizen cards
e < r = true; // slave loses to the citizen
}

{
r = r;
}
system("pause");
}

void printWager(int&x, int&y, int&a, int&b) //Asks you to give a wager by millimeters
{
x = 30; //millimeters
y = x - y; // millimeters bet
for (x = 30; x <= 30; x--);
{
cout << "How much will you wager? " << y << endl;
}

a = 1 == 100000; // emperor's side
if (int y = 1 - 30)
{
y*a;
}
else
{
x - y;
}

b = 1 == 500000; //slave's side
if (int y = 1 - 30)
{
y * b;
}
else
{
x - y;
}
cout << a << endl << b << endl;
cout << "Money: " << endl;
system("pause");
}

void win(int size, int index) //if Kaiji wins with an emperor card
{

}

int main()
{
cout << "Welcome to Emperor Card, Kaiji." << endl;
cout<<"Money: "<<endl;
printWager; //place a bet by millimeters
system("pause");
cout << "Round " <<endl;
printEmperorRound;
printSlaveRound;
printCards;

system("paused");
}
Why are you using global variables? And why are the references?
You have a lot of lines that don't make sense.

As kbw said, why are your globals references?

printEmperorRound does nothing. It initializes a local array, but that local array goes out of scope when the function exits.

printSlaveRound ditto.

if (r = 4, r <= 4, r++)
What do you think this line does? Do you know what the comma operator does?

1
2
3
4
5
6
7
{
d; // emperor
}
else
{
e; // slave
}

These lines do nothing.

system("paused");
You probably mean:
system("pause");

cout << d || e; // draws an emperor or slave card
How does this draw a card? d||e is a boolean expression.

1
2
d > r = true; //emperor wins over citizen cards
e < r = true; // slave loses to the citizen 

Huh? What kind of syntax is that? You can;t put a relational operation on the left side of an =.

r = r;
Why are you assigning a variable to itself? You're not going to change the variable.

for (x = 30; x <= 30; x--);
Two problems here.
1) You're going to have a near infinite loop here. When you decrement x, x will always be less than 30 (at least until you're run through all the negative values of x).
2) The ; at the end of the line terminates the loop, so the loop does nothing.

a = 1 == 100000;
1 will never equal 100000, so you effectively assigning 0 to a.

if (int y = 1 - 30)
You're assigning 29 to y, then testing if y is non-zero. Pointless.

1
2
b = 1 == 500000; //slave's side
if (int y = 1 - 30)

Same as last two comments.

1
2
3
4
printWager; //place a bet by millimeters
printEmperorRound;
printSlaveRound;
printCards;

Those are not valid function calls. Function calls need ().
1
2
3
4
printWager(); //place a bet by millimeters
printEmperorRound();
printSlaveRound();
printCards();


PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.









Topic archived. No new replies allowed.