디버깅을 시도하고 있지만 여기에서 문제를 파악할 수 없습니다. 올바른 매개 변수를 전달 했는데도 naiveGaussianElimination
에 대한 호출에 대해 일치하는 함수가 없다고 말하는 이유는 무엇입니까?함수에 맞는 함수가 없습니다.
void naiveGaussianElimination(int count,float doubleCoefficient[][count+1]){
}
int main() {
/*
Read from file and assign values to vector
*/
//File stream object
ifstream inputFile;
// store file name
string fileName;
// ask user for the file name and store it
cout << "Enter the file name:>> ";
cin >> fileName;
//Open the txt file
inputFile.open(fileName.c_str());
//search for the text file
if(!inputFile.is_open())
{
cerr << "Error opening file \n";
exit(EXIT_FAILURE);
}
else
{
cout << "File found and successfully opened. \n";
}
/*
find the number of variables in the equation
*/
int count =0;
string line;
while (getline(inputFile, line)){
count++;
}
// 2D array to store augmented matrix
float doubleCoefficient [count][count+1];
/*
assign values from text file to 2D array
*/
float value;
while(!inputFile.eof()){
for (int i=0; i<count; i++) {
for (int j=0; j<(count+1); j++) {
inputFile >> value;
doubleCoefficient[i][j]=value;
}
}
}
// invoke naiveGaussianElimination function
naiveGaussianElimination(count,doubleCoefficient);
가 'doubleCoefficient' 어디에도 해당 코드 샘플에 정의되지 않은 증강 매트릭스를 저장한다. 또한, 나는 C++을 많이 사용하지 않지만 함수 서명은 합법적입니까? 정확한 오류를 게시 할 수 있습니까? – slugonamission
'main'에서'naiveGaussianElimination'으로 넘겨주는'doubleCefficient' 인자는 어디서 얻고 있습니까? –
@slugonamission : 여기에 붙여 넣는 것을 잊었습니다. – Sooner