First an aside
vs reaction sometimes a little slow, turn over the place a few seconds to appear correctly
Also sometimes will complain to the right place, restart it
Back to the topic
"Threw an exception: Write access conflict.
_Left is 0xCDCDCDCD.
If the handler for this anomaly, the program can continue to operate safely."
The reason is the use of malloc when initializing the stack, and custom objects stack has string
malloc allocate memory only, not initialized, not call the constructor of the class, so that when the two call occurs, the error will
getline (cin, p-> data) ; as well as
p = (DNode *) malloc (the sizeof (DNode));
p-> Data = SS;
because string object constructor is not invoked, there is no build string object. So, getline function can not be called string object assignment, same, date can not be completed assignment.
Similarly, after you modify the program, because of the use of alternative string type is int type, so there is no case of the occurrence of the above said, it can be run.
Solution, instead of using the new the malloc,
P new = (DNode);
new calls the constructor a corresponding class initialization is completed.
Use the delete [] Note that doing so free stack