Programming fag here in need of help. Trying to get this c++ assignment done. Need help with the whole thing, but specifically #2. How do I get the values of the die back to the main? Please /b/ros help a stupid fucker out.
Posting tits for reply
Anybody can help?
Fuck off
Please guys I need halp
This is a blue board faggot
My boss just looked over my shoulder and now i have 5 minutes to pack my shit up and get out of the office. Thanks faggot.
>>51479369
Happily. Or I can post tits and hopefully get a response
>>51479410
Worksafe board, fuck off
>>51479397
Who works on a Sunday in the office?
>>51479436
Ever heard of a thing such as timezones? It's tuesday around here already
Well shit. Look I'm sorry, I was told thats how things are done here. I was just looking for help
Delete the pictures you fucking idiot. People have jobs and often come here during downtime. You want some consideration? Show some yourself.
Your problem is very simple too.
>>51478963
Holy fuck if you don't know how to do cin or simple simple simpl efunctions yet you might as well kill yourself.
Seriously though this is all very simplistic, go read up on a c++ tutorial like learncpptlearn.com
>>51478963
Professor Ziegler?
>>51479461
My bad. didnt mean to break the rules. first time on here posting for help
SFW board
Dice takes 2 argument that are Reference variables. Assign values to these in the function.
Declare the variables in main() and pass them to the function.
>>51479436
It's monday
>>51479496
Again sorry. I'm an idiot. Clearly. Any chance I could get an example of that written in code. I sorta understand the process but dont know how to eexpress it
Great I just pissed everyone off. I didnt mean to post nude shit to piss people off. Was told thats how it works. Obviously wrong
>>51479528
http://www.learncpp.com/cpp-tutorial/73-passing-arguments-by-reference/
>>51479582
This isn't /b/. the color of this board indicates SFW
>>51479607
Thanks. Sorry again. First time. I didnt realize. If anyone could give a layman's run down of this it would be great. Appreciate the link.
>>51479582
you can delete them
you literally just need to pontificate over the game phases.
need dice--> "create" two dice variables
need to roll dice--> assign dice variables result of rand()
need to add values --> create sum var, add dice values together
need to display values --> create display var, write out what needs to be displayed, pass to cout function.
needs to happen in a loop? Wrap it in a looping mechanism.
>>51479582
>Was told thats how it works.
On /b/ maybe. If you see a blue background using a normal scheme then no.
>but specifically #2. How do I get the values of the die back to the main
as the instructions say, with ref params (ie references as parameters). This means using '&' at the end of the type, and before the parameter's variable name. You assign the variable it's value inside the function.GET_FooBar_Dice(int& die) {
die = roll_die(seed);
}
So, when the die = roll_die(seed); statement returns, the result reference will be readable back at main() or whereever you called the function at.
>>51479654
err I went over that too quickly but it should be kind of clear what I meant. "need to add" should be "need to sum" and you should add the values together and assign them to sum.
>>51479582
That's okay. You can make up for it by posting cute anime girls. The more cute anime girls, the more your question is likely to get answered. That's how it works around here
1. Fuck off with the porn.
2. Fuck off with the homework.
3. Fuck off with the "/b/ros." This is not /b/. We are not /b/ros.
>>51479654
>you literally just need to pontificate over the game phases.
>need dice--> "create" two dice variables
>need to roll dice--> assign dice variables result of rand()
>need to add values --> create sum var, add dice values together
>need to display values --> create display var, write out what needs to be displayed, pass to cout function.
>needs to happen in a loop? Wrap it in a looping mechanism.
>>51479701
>>51479718
Thank you guys. Seriously. Sorry for the fuck up. This is much appreciated.
>>51479724
Spamming cute anime girls is also obnoxious. It's not as bad as porn, but it's still spam.
You can certainly include them as reaction images, though.
>>51479653
Normally, any changes to a variable in a function don't effect the original because the function receives copies of the passed arguments .
When you pass by reference, the function gets the original variable and any changes to it effect the original.
Declare dice1 and dice2 in the main() and pass them as arguments to the function.
The function arguments should be defined as REFERENCE variables like >>51479701
.