am reading this piece of code and am having a lil tough time with line 14..
I have if not dup... which should mean if dup is different from the value of dup at line 6??? am I right?.. so it means if dup is changing elsewhere in the code the initial declaration of dup holds true or what? am not getting it..
someone help me
but in the first looping...i mean the first of the for loops... chkItem will be equal to curItem...so the " if " is not statisfied and dup = true will not be executed...
so in that case can i intepret line 14 to be if (dup == true) ???
I changed the bracing style, In my personal opinion I think it looks a bit wacky to have opening braces on their own line when there is only 1 statement attached to the if. But other people have their own preferences.
IMO it is a good idea to always use braces in this way because it will save you one day when you add more code, and stops this type of interpretation:
12 13 14
dup = true; // forgot it is associated with the if
if (!dup) // will never execute?
Can you use the std::unique algorithm? Maybe you are not allowed to.
is ok the ideas man...I've also adopted your way of identation long time ago...which makes reading very long codes with lots of braces really very very easy and is the best...I did not write this code..i just have to intepret it...thanks anyway...