Skip to main content
1 of 3
Étienne
  • 223
  • 1
  • 6

On the overall, your code looks ok, some points you could improve:

  • be more consistent with indentation (you use 2 spaces and 4 spaces inconsistently, I would suggest using 4 spaces everywhere)
  • be more consistent with spacing, around "+" operator, you sometimes use spaces and sometimes not, I would suggest always using spaces
  • you should add error handling when reading data from stdin (the call to cin can fail)
  • try not to use abbreviations when not necessary, it lowers the readability of your code. "sdk" is typically used for "software development kit", I would suggest naming your function "readSudoku" instead of read_sdk.
  • Send error messages to cerr, and normal log messages to cout. For small programs this does not change a lot, but for big programs it is useful to be able to print errors only.
  • do not write if conditions on a single line, this lowers readability: ("if (...) return false"). It is easier to read when this is on two lines.
  • Do not use single letter names for parameters like "sdk v", now your code is very small so this does not change a lot, but v does not have any meaning. Naming it e.g. "grid" would be a lot better.
  • Do not use "and", "or" and "not". Prefer "&&" "||" and "!" (the written versions of the operators exist only for backwards compatibility and historical reason, they should not be used in new code, see http://stackoverflow.com/questions/2376448/the-written-versions-of-the-logical-operators)
Étienne
  • 223
  • 1
  • 6