c tokenizing a string 1

In your textbook read the section called “Tokenizing.” Practice editing, compiling, and running program 10.11 Tokenizing a String. Choose any comma separated text file that has at least 20 lines of data and write a program to parse the data using strtok() and output it like the sample program does. Just modify program 10.11 do your bidding.

If you don’t care to bring your own .csv file to the party then use the one I posted below: SAT.csv.

Hint: Delete the date related code in the sample program and use cin.getline() and cin.eof() at the appropriate places.

Hint: If your implementation is much beyond 20 or 30 lines you’ve probably gone off the rails.

upload your two files: code(.cpp) data file(.csv)

program 10.11:



using namespace std;

int main ( )

{ // Declaration of a sentence and a pointer

char str [ ] = “July 15, 2015”; char* p; // Use strtok to extract all words

p = strtok (str, “, “); // first call

while (p)

{ cout << p << endl;

p = strtok (0, “, “); // second, third, and fourth calls


return 0;


"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!