no error of compilation but my code makes codeblocks bug
Hi everybody, something may be wrong in my code even if there are no errors of compilation. But i don't know why!
Any help would be greatly appreciated.
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] = {0};
int u = 0;
int v = 0;
int line = 0;
int i = 0;
int r = line - 2;
int s = line - 1;
int f = i + 1;
for (u = 0; u <= 1 ; u ++){
for (v = 0; v<=9; v++){
finalArray[u][v] = largeArray[u][v];
}
}
for (line = 2; line <= 9 ; line ++){
for (i = 0; i<=9; i++){
finalArray[line][i] = ((finalArray[r][f]) - ( ( 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);
cout << "final array:" << endl;
printOutArray2(finalArray);
system("PAUSE");
}