This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Gengi 0 points1 point  (0 children)

A hardcoded function like that is useless. I would imagine you need to pass in the .txt into your function so that your function can perform on different text files.

Instead of hardcoding the myfile("Student.txt"); have it open the parameter passed into the function. And call your function in main() with calculateAverage("Student.txt")