Open deladan opened 5 years ago
By the way, grader is behaving differently from other activities, as it lets us have access to second test contents. It looks like it does same test twice.
Looking at the problem in EdX, I think this has to do with a misunderstanding about whether they're supposed to find the index (3) or the actual number (4) since C indexes from 0.
Hello Eli-Boardman,
I don't follow you.
According to problem statement, our program is to find first class which average is higher than ours.
In this example, it is the third class (92.5), so No 3 should be expected answer, whose index is 2.
So confusion between rank and index doesn't explain why grader expects 4 here.
And there actually is a bug with this exercise, as even provided solution isn't accepted any more.
There still is something wrong with the grader for this exercise.
Indeed, it accepts a program which returns the rank of the highest average, while it should return the rank of the first class with a higher average than ours.
For instance, if file contains 95.23 94.80 91.56 96.40 93.25, then expected answer is N° 4.
But grader accepts a program which displays N°6.
For instance, some learner's program:
#include <stdio.h>
int main(void){
FILE *ifile;
double myVar, otherVar, highest = 0;
int N = 2, class = 0;
ifile = fopen("gradeComparison.txt", "r");
fscanf(ifile, "%lf", &myVar);
while(fscanf(ifile, "%lf", &otherVar) !=EOF){
if(otherVar>highest) {
highest = otherVar;
class = N;
}
N++;
}
if(myVar >= highest) {
printf("Yes\n");
}
else if(myVar < highest) {
printf("No %d\n", class);
fclose(ifile);
}
return 0;
}
Another issue with the grader for this activity : the following program doesn't print anything when first grade is the highest, however it is accepted:
#include <stdio.h>
int main(void){
FILE *ifile;
double myGrade;
double otherGrade;
int i = 1;
ifile = fopen("gradeComparison.txt", "r");
fscanf(ifile, "%lf", &myGrade);
while(fscanf(ifile, "%lf", &otherGrade) != EOF){
i = i + 1;
if(otherGrade > myGrade){
printf("No %d", i);
break;
}
}
if(i==1){
printf("Yes");
}
fclose(ifile);
return 0;
}
In activity about finding the end of file, Taskgrader is incoherently behaving.
Provided solution isn't accepted, unless you try to submit it several times. If you try to print gradeComparison.txt contents, it seems to be the same for both tests, and, for failing test, expected answer doesn't match this content. For instance, file first lines may be : 91.5 91.5 92.5 93.5 Grader seems to expect "No 4" whereas answer should be "No 3" in this case.