#include <iostream>
usingnamespace std;
void Calc(int a_anScores[], int a_anPerc[], int a_nTotal){
for( int iii = 0; iii < a_nTotal; ++iii){
a_anScores[iii] = (a_anScores[iii] * (a_anPerc[iii]/100));
}
int nGrade=0;
for(int jjj =0; jjj<a_nTotal; jjj++){
nGrade += a_anScores[jjj];
}
cout << "Your total grade is:" << nGrade;
}
int main (){
int nTotal;
cout << "How many assessments do you have in your course: " << endl << endl;
cin >> nTotal;
int* panScores = newint[nTotal];
int* panPerc = newint[nTotal];
int jjj = 1;
for (int iii = 0; iii < nTotal; ++iii){
cout << "Please enter grade of assessment " << jjj++ << " and then its percentage: " << endl << endl;
cin >> panScores[iii];
cin >> panPerc[iii];
}
Calc(panScores, panPerc, nTotal);
system("pause");
}
It's happening at line 8. Integer division gives the quotient. The remainder is dropped.
For example: 8/5 = 1 . 3/5 = 0.
This quantity on line 8: a_anPerc[iii]/100 = 0 if a_anPerc[iii] is < 100. You will get better results using float or double type for panScores and panPerc instead of int.