So I took this program from a tutorial that I have been following and modified it to give the average of ten grades. I am having two problems, 1. I don't really know how to pass variables yet and I have read the documentation but am still left confused. As the program stands right now I get a "too few arguments error'. The 2. problem is that instead of the program just canceling out negative averages I would like to make it not take into account the vale of -1, I'm not sure where to do this.
You need to understand scope. First the variables within getGrades do not exist outside of getGrades. You have to create them in main and pass them by reference or pointer to the getGrades function. Then you have to pass them to the average function. The call to averageGrades should look more like this.
averageGrades(grade, sum, avg); // don't put the typenames in the call just the variable instances
Now I assume that you want to avoid negative numbers since negative grades make no sense. Therefore you need a technique that disallows the entry of negative numbers. This is very simply to accomplish. Take a look at the example code through this link. http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.3