Message from C, C++ talks
1. Don't use the C header files (ending in .h ) in C++. Use the C++ version of those.
2. You're including headers you don't even need.
3. Lines 23 and 24 are exactly why do while exists.
using namespace std;
5. Line 39, 40 and 64 are why for exists.
6. Why are you passing NULL to strtok on line 37?
if's could be replaced with a