Hello Drake5006,
As I started working on your program I found some errors that need to be fixed.
The lines 53 and 54:
1 2
|
float average[numOfTests];
float studentAverage[myclass.current];
| |
You can not do this. What is between the []s must either be a constant number like "10" or a variable defined as a constant. To use what you have yu would have to create a dynamic array.
It is better to use "double" over "float". "double"s have greater precision and store the numbers better. If your numbers to the right of the decimal point are short the "float" may work.
As lastchance pointed out you have the line in the header file
student student[];
. What is missing between the []s is a size. creating an empty array is not allowed.
When I write a class, struct or function I like to use a capital letter to start the name. Looking at the code in the above paragraph it looks like two variable names. The IDE and compiler may be able to tell the difference, but it can be confusing at first glance. This reads better and makes it easier to tell what the struct is:
Student student[10];
.
While I am here try to avoid using the name "Array" and especially "array" and if you use
using namespace std;
this will avoid any problems. If you have no restrictions a "std::vector" would work better than the arrays that you are trying to use. First you would not have to state a size of the vector.
You have the line:
myclass.maximum * 2;
. This has no effect because the multiplication is not stored anywhere. "myclass" is misleading because it is a struct not a class. A name that has some meaning would help. And writing the name as "myClass" is the more acceptable way to write a variable name made up of more than one word.
Line 96. And this is only a warning, but "max" is defined as an "int" and what is on the rhs of the '=' eventually gets to a "float". You can store a "float" in an "int", but you will loose anything to the right of the decimal point this may not be what you want.
Line 99. You define "cure" as a "float", but use two "int"s to initialize this with a value. This produces a warning,but it is not a big problem unless you need a decimal value.
Back to the beginning of main line 17 I changed "char*" to "std::string" to eliminate an error. In this case a "std:;string" will work fine.
Now that the program compiles and runs I can start testing.
Hope that helps,
Andy