The following code seems to be running when it shouldn't. In this example:

#include &lt;iostream&gt;
using namespace std;
int main()
{
    char data[1];
    cout&lt;&lt;"Enter data: ";
    cin&gt;&gt;data;
    cout&lt;&lt;data[2]&lt;&lt;endl;
}


Entering a string with a length greater than 1 (e.g., "Hello"), will produce output as if the array were large enough to hold it (e.g., "l"). Should this not be throwing an error when it tried to store a value that was longer than the array or when it tried to retrieve a value with an index greater than the array length?


Question: How to keep the same style of a OSM map converted to SHP file
Answer: Basically, OSM data files and shapefiles do not contain any style information.

The most common design for OpenStreetMap is the Mapnik renderer. It uses a PostgreSQL database (for perfomance reasons) and has a bunch of XML stylefiles to style the data. It's not only a question of how to render, but also the sequence of rendering, e.g. houses on top of landuses, and roads on top of that, but minor roads first and major roads last, and so on.

QGIS has a much simplier approach for rendering data. Data is rendered in the sequence it is stored in the datasource. So you won't get an easy 1:1 style adaption of the Mapnik style, even if you have the original Mapnik stylefiles.



EDIT

You did not tell us where you got the OSM data from. Reading this previous post, you are using the "old" Openstreetmap plugin. That did not allow to save the style in an easy way. A new version of the Openstreetmap plugin is on the way with QGIS 2.0. This will solve many current issues, but is not yet ready for productive use.