I wrote this code but not able to get desired result. It runs without any errors by compiler but ends unexpectedly with partially correct and incorrect data. This code was compiled on Dev C++ and codeblocks both.
Please Help.
Remove your include of stdio.h and stick to C++ iostream methods.
>cin.get(name,10);
>cin>>roll_no;
In the space of 3 lines, you used 3 separate mechanisms for inputting data.
So my guess is they're busy tripping over each others feet to give you a consistent answer.