C++ program (IMPORTANT)

Users who are viewing this thread

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
Is anybody here good with C++ programming, I am trying to make a program, and I am having trouble with it. This is very important since it is for one of my classes. If anybody reads this please help.
 
  • 57
    Replies
  • 2K
    Views
  • 0
    Participant count
    Participants list
N

NightWarrior

Guest
Ask your question. I haven't done C++ in a while, but I am confident I can help you out.
 

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
Ok well the question I had was about a program I had to do for one of my classes, however I figured it out. However, I have another program due this Monday so I'll prolly be asking some questions later today/weekend.
 

Boomer

Nipples-O-Steel
Messages
15,168
Reaction score
7
Tokenz
0.01z
Is anybody here good with C++ programming, I am trying to make a program, and I am having trouble with it. This is very important since it is for one of my classes. If anybody reads this please help.

Back in the day I could have helped, but I havent used that in a loooong time. Sorry dood.
 
N

NightWarrior

Guest
Ok well the question I had was about a program I had to do for one of my classes, however I figured it out. However, I have another program due this Monday so I'll prolly be asking some questions later today/weekend.

Better ask them sooner than later, I'll be detained and away from a pc all weekend :(
 

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
Ok so I hope it's not too late to post this cry for help. I have started on this a tad late but hopefully you guys can help me.

So here's the description for the program I have due for class. The only problem I have is the loop and decision for the die rolling game.

Here's the document for download: YourFileHost.com - Free hosting for ALL your files S3

And here's my C++ code so: YourFileHost.com - Free hosting for ALL your files S3

I don't have much done yet but I was wondering if anybody could point me in the right direction concerning the loop and decision part of the code. Also any help in general would be great.

Thanks again peoples.
 
N

NightWarrior

Guest
This is actually pretty easy. I will help you with this tomorrow as I don't have time to write it up right now.
 

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
This is actually pretty easy. I will help you with this tomorrow as I don't have time to write it up right now.

OK thanks for the help. Not to sound bossy or anything but I only have until about 12:30 tmrw. Sry for the short notice.
 

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
I pretty much have what i had yesterday I am totally lost. I don't have a clue what type of loop to use. I am in dire need of help.
 
N

NightWarrior

Guest
Ok, well you are going to need some variables to keep track of what each player is rolling. You can use any of the loops, it doesn't matter. However I'd use a While(1) loop (this loop continues forever since the test for 1 is always true). This way you can just break out of it when your condition your looking for holds true. Inside the loop, you'll simulate the rolling of the die for each of the 3 players...You add this to their grand total variables testing to see if the value is > 20 for each of them. Once you've found one that is greater than 20, you then test it against the other 2 to see which one is the highest... You should be able to figure this out...If not let me know, I'll throw some code out...
 
N

NightWarrior

Guest
//inside main()
int player1, player2, player3;
player 1 = 0;
player 2 = 0;
player 3 = 0;
while (1) {

player1 += rollDie();
player2 += rollDie();
player3 += rollDie();
//you also need to be building your print out statements here for your graph
//displaying the representation for what each player has
if (player1 > 20 || player2 > 20 || player3 > 20) {

break;
}
} // end while

//now test to see who has the most...
//I'll let you figure out the rest!


int rollDie()
{
return (rand() % 6) + 1;
}
 
78,874Threads
2,185,387Messages
4,959Members
Back
Top