#include #include int main() { /* The ID list Customer ID = 25453; Company ID = 39828; Part-typeID = 43455; */ /* the pointer to the file "ptype.dat" */ FILE *p; char TemName1[10]; char TemEmail[25]; char sp = '|'; int i,j,r1,r2,Temptid; /* The company ID */ int sid; int snum = 39828; /* The part-type ID */ int tid = 43455; int tnum = 43455; /* The name of the part-types */ char *pname[] = { "Brake system", "Heatsytem", "Fuel system", "Suspension system", "Transmission system", "Steering system", "Body/Chassis parts", "Engine system", "Accessories", "Exhaust system", "Electrical system", "A/C system", "Filters" }; /* The information regarding each part */ char *pinf = "readcatalog"; int tarrif; p = fopen("ptype.dat","w"); // This is for the companies for ( i =0; i < 500; i++) { sid = snum + i; Temptid = tid; // The company has different tarrif for each type of part for ( j = 0; j < 13; j++) { tarrif = (int)(1000.0*rand()/(RAND_MAX + 1.0)); fprintf(p,"%d %c %d %c %s %c %s %c %d\n", sid,sp,Temptid,sp, pname[Temptid-43455],sp,pinf,sp,tarrif); Temptid++; if (Temptid > 43467) Temptid = 43455; } } return 0; }