if (moduleChoice == 1,
gradeTestMain());
should be changed to
if (moduleChoice == 1)
gradeTestMain();
Likewise for other ifs.
You need to close brackets – otherwise it means
if (moduleChoice == 1, gradeTestMain());
which means
if (moduleChoice == 1, gradeTestMain())
{
;
}
which means.
evaluate moduleChoice == 1, throw away the result, then evalutate gradeTestMain().
Then check whether the return value of gradeTestMain() is true or false. But again, because there is nothing inside the if, irrespective of whether gradeTestMain returns true or false, the result is the same.
Another thing is that
if (moduleChoice /= 1,0,
doesn’t do what you think it does. Change it to an else. Change the previous if to an else if
So you need
if (moduleChoice == 1)
gradeTestMain();
else if (moduleChoice == 0)
printf ("Thank you for using GradeTest version 1.1! Have a great day!");
else
printf ("That is not a valid choice. Please try again.");
It may be a good idea to invest in a book.
1
solved How can I make this work? (C)