A few comments.
Lines 7-8: I suspect you want to make these arrays, not simple variables.
Lines 7-9: It's best practice to avoid global variables where possible. General rule is to make variables as local as possible.
Line 9: linecount is an index and should be an int, not a double.
Line 22: You've passed options by reference. That's fine, however, you've also made optionsFunc() an
int
function. When you're returning a value from a function, you should do it one way or the other. Generally, not a good idea to do it both ways. For simple values, I prefer using the return value.
1 2
|
options = optionsFunc ();
|
Lines 23-41: You should consider the use of a
switch
statement here.
http://www.cplusplus.com/doc/tutorial/control/
Lines 45-48: optionsFunc() should not return a value that is other than 1-5. Therefore, the else clause is unnecessary.
Line 72: The
while
clause is going to allow you out of the loop when any value other than 5 is chosen. This is not what you want. You want optionsFunc() to only return a valid value. Change your while clause to:
|
while (options < 1 || options > 5);
|
Line 73: Since optionsFunc() is declared an
int
function, it should return a value:
Line 77: You never call displaySalesPeople(). You also never declare names or sales arrays to pass to this function.
Line 62,79: Your menu says "1. open sales file", but you're opening it here on line 79. Did you mean to open the sales file and read it into the respective arrays if 1 was selected? If so, then lines 79-86 should iterate through the arrays and you need a different function to read from the file into the arrays.
Line 82: If displaySalesPeople() is called more than once, linecount is going to go out of bounds.