Hi everyboy ! While compiling, i get this error :
error : declaration of 'float finalArray[9][9]' shadows a parameter
I don't understand where does it come from. Here is my code :
Code:
#include <iostream>#include <iomanip>
#include <cstdlib>
using namespace std;
void initArray(float largeArray[6][6]){
for (int x=0; x < 6; x++){
for (int y=0; y<6; y++){
largeArray[x][y] = 0;
}
}
}
float printOutArray(float largeArray[6][6]){
for (int x = 0; x < 6; x++){
for (int y = 0; y < 6; y++){
cout << largeArray [x] [y]<<'\t';
}
cout << endl;
}
return largeArray[6][6];
}
float tata (int degree_denominator, float largeArray[6][6] )
{
float array_of_coefficients[6];
int c=0;
int l=0;
int x;
for (x=degree_denominator ; x>=0 ; x--){
if (l==2){l=0;c++;}
cout << "what is the coefficient linked with degree" << x << "?" << endl;
cin >> array_of_coefficients[x];
largeArray[l][c] = array_of_coefficients[x];
l++;
}
return largeArray[6][6];
}
float toto(float largeArray[6][6], float finalArray[9][9])
{
float finalArray[9][9] = {0};
int line = 0;
int i = 0;
int r = line -2;
int s = line - 1;
int f = i + 1;
for (line = 0; line <= 1 ; line ++){
for (i = 0; i<=6; i++){
finalArray[line][i] = largeArray[line][i];
}
}
for (line = 2; line <= 9 ; line ++){
for (i = 0; i<=6; i++){
finalArray[line][i] = ((finalArray[line][i]) - ( ( finalArray[s][f] ) * ( (finalArray[r][i])/ (finalArray[s][i])) ) ) ;
}
}
return finalArray[9][9];
}
float printOutArray2(float finalArray[9][9]){
for (int x = 0; x <= 9; x++){
for (int y = 0; y <= 9; y++){
cout << finalArray [x] [y]<<'\t';
}
cout << endl;
}
return finalArray[9][9];
}
int main()
{
float finalArray [9][9];
float largeArray [6][6];
initArray(largeArray);
printOutArray(largeArray);
int degree_denominator;
cout << "what is the degree of the denominator?" << endl;
cin >> degree_denominator;
tata(degree_denominator, largeArray);
printOutArray(largeArray);
toto(largeArray,finalArray);
cout << "final array:" << endl;
printOutArray2(finalArray);
system("PAUSE");
}
Thank you in advance for your help!