I'm attempting to create a program which extracts a polynomial equation from a file and adds, subtracts, or multiplies the two polynomials together (depending upon the middle operand). However, I'm getting a two compiler errors that I can't quite make sense of.
The first occurs here:
int** getPolynomial(string polynomial, int &count, string Exponent[], string Coefficient[], int polyArray[][1]){
for (int i = 0; i<100; i++){
for (int n = 0; n<100; n++){
Exponent[n] = atoi(polyArray[n][1]);
}
Coefficient[i] = atoi(polyArray[i][0]);
}
}
Where I'm getting an error "argument of type 'int*' is incompatible with type 'const char*' " on the lines
Exponent[n] = atoi(polyArray[n][1]);
}
Coefficient[i] = atoi(polyArray[i][0]);
Second error occurs just below,
int** add(int **left, int leftCount, int **right, int countRight, int &countResult){
for (int q; q < leftCount; q++){
for (int r = 0; r < 2; r++){
if (left[q][1] == right[q][r]){
countResult[q][0] = left[q][0] + right[q][0];
}
}
}
}
On the line countResult[q][0] = left[q][0] + right[q][0];
, where the compiler is noting that the first q "expression must have pointer-to-object type", although I can't see how making q a pointer would help.
Full code here: http://pastebin.com/FsM1ydE5. Any help on this matter would be greatly appreciated.