Hello! I know it isnt very appropriate, but I have already posted this question on stackoverflow. However, this is a very time sensitive issue and I still need a great amount of help with it and havent gotten any responses there. With that said, I hope that you guys may be able to help me out :)

I've been trying to figure out how to format this part of my code for a c++ craps game. I've got most of it done, but the settle wager function is giving me an issue. Here are the parameters of the game.

There are twenty rounds
Each player starts out with 1000 dollars. Player 1 bets 100 dollars every time they go. However, player 2 bets 150 dollars if they have more than 1000 dollars. If they have less, they bet 50 dollars.
A 7 or an 11 is a natural. The current player wins
A 2,3, or 12 is a crap. The player loses.
If it is any other number, the number in question is set as the point. The player rolls over and over again until they either get the point number, which would be a win, or a 7, which would be a loss. The player that wins gets to keep the dice and go again.

Output looks something like this for reference:

Wager 1 : Bet is $100
Player 1 is rolling the dice
The roll is 2 That is craps! Player 1 loses.
Currently, Player 1 has $900 and Player 2 has $1100.

My TA said to use a function for settling the wager and passing the values by reference would be the best way to go. I've looked up how to do it, but I don't really understand it at all. The function is supposed to take the bet (either a high (150) or low (50) bet from player two and pass it to player 1 on a loss or collect from player 1 on a win, or take the 100 dollar bet from player 1 and collect it from player 2 on a win or pass it to player 2 on a loss. This is the function that is supposed to decide the values for the last line of the reference above. What I have so far is not even close to being right I'm sure. The link to my code I have so far is: https://stackoverflow.com/questions/66523303/problem-with-passing-by-reference-craps-game since I cant figure out how to format code into this forum. Again, I'm very sorry if it is inappropriate to ask on multiple forums. Any help would be appreciated! Let me know if any clarification is needed

I see you wrote a lot but didn't focus on the pass by reference issue so most will pass this post up since you didn't get to the heart of the matter.

There are many tutorials about the pass by reference so I will avoid duplicating that here. Read:
https://www.tutorialspoint.com/cplusplus/cpp_function_call_by_reference.htm

Again, this is your homework and when you reach out for help you must be specific. Telling all about the twenty rounds and more when you need to understand pass by reference may be why no one responded. Read the link I supplied as it covered pass by reference for most students.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.