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 the
+
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 tocin
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 functionreadSudoku
instead ofread_sdk
. - Send error messages to
cerr
, and normal log messages tocout
. 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, butv
does not have any meaning. Naming it e.g.grid
would be a lot better. - Do not use
and
,or
andnot
. 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 this this).
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 the
+
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 tocin
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 functionreadSudoku
instead ofread_sdk
. - Send error messages to
cerr
, and normal log messages tocout
. 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, butv
does not have any meaning. Naming it e.g.grid
would be a lot better. - Do not use
and
,or
andnot
. 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 this).
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 the
+
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 tocin
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 functionreadSudoku
instead ofread_sdk
. - Send error messages to
cerr
, and normal log messages tocout
. 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, butv
does not have any meaning. Naming it e.g.grid
would be a lot better. - Do not use
and
,or
andnot
. 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 this).
On the overall, your code looks ok, some. Some points you could improve:
- beBe more consistent with indentation (you use 2 spaces and 4 spaces inconsistently,. I would suggest using 4 spaces everywhere).
- beBe more consistent with spacing, around "+". Around the
+
operator, you sometimes use spaces and sometimes not,. I would suggest always using spaces. - youYou should add error handling when reading data from stdin
stdin
(the call to cincin
can fail). - tryTry not to use abbreviations when not necessary,necessary; it lowers the readability of your code. "sdk"
sdk
is typically used for "software development kit",. I would suggest naming your function "readSudoku"readSudoku
instead of read_sdkread_sdk
. - Send error messages to cerr
cerr
, and normal log messages to coutcout
. For small programs this does not change a lot, but for big programs it is useful to be able to print errors only. - doDo not write if
if
conditions on a single line,line; this lowers readability: ("if (...) return false"if (...) return false
). It is easier to read when this is on two lines lines. - Do not use single letter names for parameters like "sdk v", now
sdk v
. Now your code is very small so this does not change a lot, but vv
does not have any meaning. Naming it e.g. "grid"grid
would be a lot better. - Do not use "and"
and
, "or"or
and "not"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-operatorsthis).
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)
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 the
+
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 tocin
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 functionreadSudoku
instead ofread_sdk
. - Send error messages to
cerr
, and normal log messages tocout
. 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, butv
does not have any meaning. Naming it e.g.grid
would be a lot better. - Do not use
and
,or
andnot
. 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 this).
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)