for (hashingfunction=1;hashingfunction<=4;hashingfunction++) {
for (openaddresing=1;openaddresing<=3;openaddresing++) {
for (loadfactor=0.1;loadfactor<=0.7;loadfactor+=0.05) {
for (I=1;I<=10;I++) {
hash.create(181,hashingfunction,openaddresing);
hash.rand(loadfactor);
probes[hashingfunction][openaddresing][loadfactor] += hash.printstat();
}
probes[hashingfunction][openaddresing][loadfactor] /= (10*round(181*loadfactor));
}
}
}
Here probes array (three dimensional) gives you the data needed to plot loading factor vs average probes (by average robes I mean the total probes divided by the number of data in the hash table, thus average probes for a data).
FILE *f;
f = fopen("test.txt","r"); // to open a file for reading
f = fopen("test.txt","w"); // to open a file for writing,
You can use fscanf, fgets, fgetc to read from file. But I suggest you to use fgets.
char msg[10]; fgets(msg, 9, f); // reads 9 char or up to end of line // (which comes first) from file pointed // by f and assigns msg char msg2[] = "Output"; fputs(msg2, f); // writes the content of msg2 // to the file pointed by f