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 101public 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.
>>54755076foldl1' 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/