[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Programming fag here in need of help. Trying to get this c++
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 30
Thread images: 4
File: hw4.jpg (661 KB, 2050x2636) Image search: [Google]
hw4.jpg
661 KB, 2050x2636
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.
>>
File: sexy-latina-veronica-rodriguez3.jpg (74 KB, 720x1080) Image search: [Google]
sexy-latina-veronica-rodriguez3.jpg
74 KB, 720x1080
Posting tits for reply
>>
File: url.jpg (9 KB, 183x275) Image search: [Google]
url.jpg
9 KB, 183x275
>>
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.
>>
File: starecat.jpg (733 KB, 3950x3950) Image search: [Google]
starecat.jpg
733 KB, 3950x3950
>>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
.
Thread replies: 30
Thread images: 4

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.