Skip to main content
Added links for the std::map section.
Source Link
pacmaninbw
  • 24.8k
  • 11
  • 46
  • 109

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese?

Since the code might be useful in many places it might be better of the translation code as in a class.

Use of Vertical Space
Generally code is easier to read and maintain when only one value is on a line. This would apply to the initialization of the vectors and the switch statement in the function is_vowel(). For maintenance reasons it is much easier to insert a line where it needs to be than it is to add a value to a comma separated list.

is_vowel function
There would be less code and the performance might be better if the vowels were in a std::map rather than a switch statement. Here are discussions on stack overflow and software engineering.

This portion of the answer has been modified to remove the statement that there might be a performance improvement using std::map. If map used a simple index into an array that might be true, however it is not a simple index into an array.

Assert
Assert statements are generally used for debugging purposes and terminate the program. Assert statements may be removed when the code is compiled without debugging as well. I don't expect to see asserts in production level code because it implies that the code is not yet debugged.

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese?

Since the code might be useful in many places it might be better of the translation code as in a class.

Use of Vertical Space
Generally code is easier to read and maintain when only one value is on a line. This would apply to the initialization of the vectors and the switch statement in the function is_vowel(). For maintenance reasons it is much easier to insert a line where it needs to be than it is to add a value to a comma separated list.

is_vowel function
There would be less code and the performance might be better if the vowels were in a std::map rather than a switch statement.

Assert
Assert statements are generally used for debugging purposes and terminate the program. Assert statements may be removed when the code is compiled without debugging as well. I don't expect to see asserts in production level code because it implies that the code is not yet debugged.

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese?

Since the code might be useful in many places it might be better of the translation code as in a class.

Use of Vertical Space
Generally code is easier to read and maintain when only one value is on a line. This would apply to the initialization of the vectors and the switch statement in the function is_vowel(). For maintenance reasons it is much easier to insert a line where it needs to be than it is to add a value to a comma separated list.

is_vowel function
There would be less code if the vowels were in a std::map rather than a switch statement. Here are discussions on stack overflow and software engineering.

This portion of the answer has been modified to remove the statement that there might be a performance improvement using std::map. If map used a simple index into an array that might be true, however it is not a simple index into an array.

Assert
Assert statements are generally used for debugging purposes and terminate the program. Assert statements may be removed when the code is compiled without debugging as well. I don't expect to see asserts in production level code because it implies that the code is not yet debugged.

Added link to stack overflow discussion of asserts.
Source Link
pacmaninbw
  • 24.8k
  • 11
  • 46
  • 109

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese?

Since the code might be useful in many places it might be better of the translation code as in a class.

Use of Vertical Space
Generally code is easier to read and maintain when only one value is on a line. This would apply to the initialization of the vectors and the switch statement in the function is_vowel(). For maintenance reasons it is much easier to insert a line where it needs to be than it is to add a value to a comma separated list.

is_vowel function
There would be less code and the performance might be better if the vowels were in a std::map rather than a switch statement.

Assert
Assert statements are generally used for debugging purposes and terminate the programAssert statements are generally used for debugging purposes and terminate the program. Assert statements may be removed when the code is compiled without debugging as well. I don't expect to see asserts in production level code because it implies that the code is not yet debugged.

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese?

Since the code might be useful in many places it might be better of the translation code as in a class.

Use of Vertical Space
Generally code is easier to read and maintain when only one value is on a line. This would apply to the initialization of the vectors and the switch statement in the function is_vowel(). For maintenance reasons it is much easier to insert a line where it needs to be than it is to add a value to a comma separated list.

is_vowel function
There would be less code and the performance might be better if the vowels were in a std::map rather than a switch statement.

Assert
Assert statements are generally used for debugging purposes and terminate the program. Assert statements may be removed when the code is compiled without debugging as well. I don't expect to see asserts in production level code because it implies that the code is not yet debugged.

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese?

Since the code might be useful in many places it might be better of the translation code as in a class.

Use of Vertical Space
Generally code is easier to read and maintain when only one value is on a line. This would apply to the initialization of the vectors and the switch statement in the function is_vowel(). For maintenance reasons it is much easier to insert a line where it needs to be than it is to add a value to a comma separated list.

is_vowel function
There would be less code and the performance might be better if the vowels were in a std::map rather than a switch statement.

Assert
Assert statements are generally used for debugging purposes and terminate the program. Assert statements may be removed when the code is compiled without debugging as well. I don't expect to see asserts in production level code because it implies that the code is not yet debugged.

Removed generalization of error statement verus asserts.
Source Link
pacmaninbw
  • 24.8k
  • 11
  • 46
  • 109

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese?

Since the code might be useful in many places it might be better of the translation code as in a class.

Use of Vertical Space
Generally code is easier to read and maintain when only one value is on a line. This would apply to the initialization of the vectors and the switch statement in the function is_vowel(). For maintenance reasons it is much easier to insert a line where it needs to be than it is to add a value to a comma separated list.

is_vowel function
There would be less code and the performance might be better if the vowels were in a std::map rather than a switch statement.

Assert
Assert statements are generally used for debugging purposes and terminate the program. Assert statements may be removed when the code is compiled without debugging as well. It is generally betterI don't expect to use if statementssee asserts in production level code because it implies that provide error messages rather than assert statementsthe code is not yet debugged.

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese?

Since the code might be useful in many places it might be better of the translation code as in a class.

Use of Vertical Space
Generally code is easier to read and maintain when only one value is on a line. This would apply to the initialization of the vectors and the switch statement in the function is_vowel(). For maintenance reasons it is much easier to insert a line where it needs to be than it is to add a value to a comma separated list.

is_vowel function
There would be less code and the performance might be better if the vowels were in a std::map rather than a switch statement.

Assert
Assert statements are generally used for debugging purposes and terminate the program. Assert statements may be removed when the code is compiled without debugging as well. It is generally better to use if statements that provide error messages rather than assert statements.

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese?

Since the code might be useful in many places it might be better of the translation code as in a class.

Use of Vertical Space
Generally code is easier to read and maintain when only one value is on a line. This would apply to the initialization of the vectors and the switch statement in the function is_vowel(). For maintenance reasons it is much easier to insert a line where it needs to be than it is to add a value to a comma separated list.

is_vowel function
There would be less code and the performance might be better if the vowels were in a std::map rather than a switch statement.

Assert
Assert statements are generally used for debugging purposes and terminate the program. Assert statements may be removed when the code is compiled without debugging as well. I don't expect to see asserts in production level code because it implies that the code is not yet debugged.

Changed throw exception to terminate program.
Source Link
pacmaninbw
  • 24.8k
  • 11
  • 46
  • 109
Loading
Source Link
pacmaninbw
  • 24.8k
  • 11
  • 46
  • 109
Loading