#include <iostream>
usingnamespace std;
short*MAX = NULL;
void applyTests (short []);
void displayTests (short []);
int main (void)
{
short ntests;
cout << "How many grades would you like to enter: ";
cin >> ntests;
short*testscores = newshort [ntests];
MAX = &ntests;
cout << "Max nTests = " << ntests << endl << endl;
applyTests (testscores);
displayTests (testscores);
delete [] testscores;
return 0;
}
void applyTests (short tests [])
{
for (short i = 0; i << *MAX; i++)
{
cout << "Test #" << i + 1 << ": ";
cin >> tests [i];
}
cout << endl;
}
void displayTests (short tests [])
{
for (short i = 0; i << *MAX; i++)
cout << "Test #" << i + 1 << " is " << tests[i] << endl;
}
I'm practing C++ and I'm trying to assign and display values to the testscores array. But whenever I input how many grades I would like to enter, the program ends without showing the two functions which was next. Any help?