It's worth noting that C and C++ are different languages - C++ is not really a strict superset of C as is commonly believed. Even if it were, C++ comes with its own set of idiomatic practices, separate from C.
All this business regarding atoi, strtok, malloc, and the like is idiomatic C, not C++. In C++, the correct way to convert between strings and numeric types is to use the
stringstream class. You should also prefer the
new keyword instead of malloc.
I know that you need to work under the constraints of your CS class, but for future reference: if you're using C++, use C++. Prefer not to use the archaic C functions when better alternatives exist.
For example, prefer std::stringstream instead of atoi because is more generic in that it can convert both to and from strings and numeric data. It also has better error-reporting - atoi will return 0 even if the input string is incorrect whereas stringstream will signal errors if they occur. The new keyword should be preferred instead of malloc because new is typesafe and calls constructors for non-POD types, whereas malloc does not.
Dealing with individual characters is also not needed in C++ - the stream extraction operator (>>) in IO objects are by default designed to automatically "tokenise" the input according to whitespace.
A C++ example to copy all the numbers into two vectors:
http://pastebin.com/f14e18665
It's a bit long due to all the comments, but I think you get the general idea.