[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
Can anyone provide me with an example of a 'find max'
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: 13
Thread images: 1
File: Gibs dem jezuz.gif (1 MB, 260x169) Image search: [Google]
Gibs dem jezuz.gif
1 MB, 260x169
Can anyone provide me with an example of a 'find max' algorithm in either C# or C++?
>>
>>54755076
I did it in Java for you ;^)

How the fuck couldn't you solve it yourself? It's literally programming 101

public int findMax(int[] input){
int max = input[0];

for(int i = 0; i < input.length; i++){
if(max<input[i]){
max = input[i];
}
}

return max;
}

>>
>>54755146
Yeah, I'm just a beginner haha. Thanks man
>>
>>54755182
Alright, we have all been there, good luck anon
>>
int max(int *i, int size)
{
int j, max=0;
for(j=0; j<size; j++)
{
if (j > *i) max = *i;
i++;
}
return max;
}
>>
>>54755212
not op, what star * symbol does in c++, i see it a lot of
>>
>>54755146
>using the smiley with a carat nose
>>
>>54755378
>replying with "using the smiley with a carat nose"
>>
>>54755353
Defines a pointer, or dereferences one.
>>
>>54755076
foldl1' max

haslel
>>
>>54755353
The star symbol (aka nova) in C++ is basically just you, as the programmer, specifying that this variable is of more importance than the other. Thus it is the "star" of the function or "nova".
>>
>>54755353
multiplication
>>
>>54755353
http://www.cplusplus.com/doc/tutorial/pointers/
Thread replies: 13
Thread images: 1

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.