Background - Am trying to allocate a file a number of points depending on how relavent it it to a word entered by a user. At present the program finds which line the word occurs on and also how many lines there are in the file.
Aim - To divide the program up into 10 sections (ie. divide linepoint by 10) and allocate 100 points for each time the word occurs in the first 10% of the code and then 90 points for each time the word occurs in the first 20% of the code and so on.
At present am having problems as was trying to say:
if ((strstr (pointstemp, pointsword))==((linepoint/100)*10))
but threw up warnings are i was trying to compare a char and an int and so was not working effectively.
Any ideas would be greatly appreciated as am having serious problems with this. Thanks very much in advance.
My code so far is...
printf("Please enter file name: ");
printf("Please enter word: ");
if ((pp = fopen(pointsfilename, "r")) == NULL)
while( fgets(pointstemp, 256, pp) != NULL)
if ((strstr(pointstemp, pointsword)) !=NULL)
printf("Line number containing %s is %d\n", pointsword, linepoint);
printf("Number of lines is %d\n", linepoint);
if (findpoint == 0)
printf("\nNo match found.\n");