Changes

Jump to: navigation, search

C/C++ FAQ

818 bytes added, 13:14, 30 October 2012
no edit summary
'''Q:''' How to redirect cerr to a file (instead of a console window)? <br>
'''A:'''Use the rdbuf( ) method. [http://c.ittoolbox.com/groups/technical-functional/cpp-l/cpp-how-to-redirect-error-stream-to-a-file-in-c-1027328]<br>
 
 
'''Q:''' How to visualise a multi dimensional array? <br>
'''A:'''
 
The simplest way to do so for a 2 dimensional array is a table
<source lang="cpp">
0123
4567
7890
</source>
 
It gets slightly more complex when it comes to 3 dimensional arrays
*First what comes to mind of majority of people is a cube
<source lang="cpp">
__________
/\444444444\
/\3\444444444\
/\2\3\444444444\
/\1\2\3\444444444\
\0\1\2\/33333333\/
\0\1\/22222222\/
\0\/11111111\/
\/00000000\/
</source><br>
(There are many disadvantages to using this form besides awkwardness!)
 
 
*Another way is to display each of the layers as separate 2 dimensional arrays
<source lang="cpp">
111
111
111
 
222
222
222
 
333
333
333
</source>
 
 
 
'''To Continue (Feel free to add your ideas! :D)'''
 
 
 
 
Submitted by Team42

Navigation menu