I have a vector of colors, its elements are "red", "blue", "black" ...
how can I find which element has the longest name ?
I been playing with this for fwe hours and still can't figure this out.
Printable View
I have a vector of colors, its elements are "red", "blue", "black" ...
how can I find which element has the longest name ?
I been playing with this for fwe hours and still can't figure this out.
How about this to start off with?
Code:T max = a[0];
for ( i = 1; i < n; i++ ) {
if ( a[i] > max )
max = a[i];
}