Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
cpp [2018/08/09 11:34] jguerin |
cpp [2018/08/28 13:29] (current) jguerin Changed IO links to reflect the Python sections. |
| |
===== When to use C++ ===== | ===== When to use C++ ===== |
| Whenever you have questions about time or memory limits, C++ is typically a safer path than [[python3|Python3]]. C++ contains most of the C library (when limits really put you in a pinch) and(at a higher level) boasts a well-established [[http://www.cplusplus.com/reference/|standard library]] of generics through templates. Many competitive programmers are versed in preprocessor macros that make C++ feel more like [[python3|Python3]] as well. |
| |
===== When not to use C++ ===== | ===== When not to use C++ ===== |
Unlike [[python3|Python3]], it is difficult to argue that C++ is ever a //poor// choice for a contest problem. Well-written C++ is difficult to beat in terms of runtime efficiency. C++ boasts a well-established [[http://www.cplusplus.com/reference/|standard library]] of generics through templates, and many competitive programmers are versed in preprocessor macros that make C++ fell more like [[python3|Python3]]. | Unlike [[python3|Python3]], it is difficult to argue that C++ is ever a //poor// choice for a contest problem. Well-written C++ is difficult to beat in terms of runtime efficiency. |
| |
However, for all the benefits of C++, well written [[python3|Python3]] can be generated in fewer keystrokes than is possible in C++ or Java.((The standard "[[files:cpp:hello|Hello World!]]" in C++ takes can be accomplished in 107 keystrokes (not including editor commands) including the inclusion of ''iostream'', the use of ''namespace std'', typical whitespace/formatting, and C++ streams for output. It is virtually impossible (in any language) to beat the 22 characters of "[[files:python3:hello|Hello World]]" in Python3.)) This is due to both the terse syntax, and the lack of any required boilerplate in the most basic program. | However, for all the benefits of C++, well written [[python3|Python3]] can be generated in fewer keystrokes than is possible in C++ or Java.((The standard "[[files:cpp:hello|Hello World!]]" in C++ takes can be accomplished in 107 keystrokes (not including editor commands) including the inclusion of ''iostream'', the use of ''namespace std'', typical whitespace/formatting, and C++ streams for output. It is virtually impossible (in any language) to beat the 22 characters of "[[files:python3:hello|Hello World]]" in Python3.)) This is due to both the terse syntax, and the lack of any required boilerplate in the most basic program. |
| |
===== Input/Output ===== | ===== Input/Output ===== |
* [[cpp:basic_io|Basic IO]] operations | * [[cpp:input|Input]] for Programming Contests |
* [[cpp:faster_io|Faster IO]] for competitive programming | * [[cpp:output|Output]] for Programming Contests |
| |
===== Data Structures ===== | ===== Data Structures ===== |