/* quiz.tc - tct - 2/19,21-22/2010 /* split char string s delimited by char string delim into int array t split int t(0);char s(0),delim(0) [ int y,ix,tx,sl int ds ds=strlen(delim) t(0)=s;sl=strlen(s) while (sl-tx) [ ix=index(s+tx,sl-tx,delim,ds) tx=tx+ix+ds-1 t(++y)=s+tx s(tx-ds)=0 ] return y ] /* sample command line : .quiz "quiz.txt","response.txt" quiz char qf(0),rf(0) [ /* present quiz questions, write responses int nk,kas,as,i,ikwiz(20),ks char kwiza(1000),ka(100),kwiz(2000),crlf(2),qcrlf(3) pl "";ps "quiz.tc - tct - 2/19,21-22/2010";pl "" pl "please visit http://primepuzzle.com/tc/quiz.html";pl "";pl "" crlf(0)=13;crlf(1)=10;qcrlf(0)='?';strcat(qcrlf,crlf) if ((ks=readfile(qf,kwiz,kwiz+2000-1,1))<=0) [ ps "error on read quiz";exit ] strcat(kwiz,qcrlf) nk=split(ikwiz,kwiz,qcrlf) for (i=0;i