#include <iostream>
#include <cstring>

using namespace std;

enum Format {NAME, IGNORE, EGGS};

class A{
public:
    char name[30];
    int eggs;
};

int main(){
    A a1;
    char line[30] = "jane,the best,,,13";

    char * temp = strtok(line, ","); //"jane\0the best\013";

    int count = 0;
    while (temp != NULL){
	cout << temp <<endl;

	switch(count++){
	case NAME: strcpy(a1.name, temp); break;
	case IGNORE: break;
	    //	case DATE: readDate(temp); break;
	case EGGS: a1.eggs = atoi(temp); break;
	default: cout << "ERROR\n";
	}

	temp = strtok(NULL, ",");
    }

    cout << "a1:" << a1.name << " " << a1.eggs << endl;

    return 0;
}

