Thread: Code Critique
View Single Post
Old Jun 3rd, 2006, 4:16 AM   #6
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,253
Rep Power: 5 grumpy will become famous soon enough
A couple more comments

1) If you use a test case that contains two or more spaces in sequence, the histogram will not be correct. I'm guessing all your test cases only have one space between two words.

2) Something that works along the lines;
  ++x;
  if (some_condition)
  {
        --x;
        more_stuff();
  }
can be expressed more cleanly in the form;
[code]
  if (some_condition)
  {
        more_stuff();
  }
  else
  {
      ++x;
  }
Your last code snippet is in that form .....
grumpy is offline   Reply With Quote