#include #include int main() { /* The ID list Customer ID = 25453; Company ID = 39828; Part-typeID = 43455; Part ID = 89888; RFP ID = 67000; */ /* the pointer to the file "rfp.dat" */ FILE *p; char TemName1[10]; char TemEmail[25]; char sp = '|'; int i,j,r1,r2,Temptid; /* The part-type ID */ int tid = 0; int tnum = 43455; /* The part ID */ int pid =0; int pnum = 89888; /* The customer ID */ int cid =0; int cnum = 25453; int comp_num,comp_seed,p_seed,t_seed,qty; int sid; //float initial_value = 440.0; p = fopen("rfp.dat","w"); cid = cnum; tid = tnum; pid = pnum; sid = 39828; for (i =0 ; i < 500; i++) { cid = cnum + i; // choose a random number of companies comp_num = (int)(100.0*rand()/(RAND_MAX + 1.0)); comp_seed = (int)(400.0*rand()/(RAND_MAX+1.0)); // For each such company for ( j = 0; j < comp_num; j++) { // select a random part type & a part p_seed = (int)(104.0*rand()/(RAND_MAX +0.0)); t_seed = (int)(13.0*rand()/(RAND_MAX +0.0)); qty = (int)(25.0*rand()/(RAND_MAX+0.0)); fprintf(p,"%d %c %d %c %d %c %d %c %d\n", cid,sp, sid+comp_seed+j,sp,tid+t_seed,sp,pid+p_seed, sp,qty); } } return 0; }