a) when is endl better then \n?
I've found an old topic here (http://www.thescripts.com/forum/thread133064.html) which says that endl flushes the buffer but doesn't really go into when which is or becomes more efficient.
b) is this coding efficient or still some leeway from improvement.
Basicly I want to check if the first letter is the same as the last letter, second same as the letter before the last, ... (I don't like the make it to easy for searchers when I post code ;) ).
Expand|Select|Wrap|Line Numbers
- for(int i=0;(length%2==0?i!=length/2:i+1!=length/2);++i){
- if(word[i]!=word[length-i-1])
- correct=0;
- }
I get the length with:
Expand|Select|Wrap|Line Numbers
- for(int i=0;word[i]!='\0';++i)
- ++length;