Alright i'm writing a program using 2 seperate functions det2()and det3(). The function det2() is supposed to calculate the determinant of a 2X2 matrix. Then i'm supposed to be using det3() to calculate the determinant of a 3X3 matrix which will call upon the det2 function to solve the required 2X2 matrices. I finally got the program to run but i'm getting a value of -1#QNAN, with any inputs I use. Not even sure what the heck that QNAN is and wondering if someone might know where i'm going wrong here. Thank You.
here is the code.
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
void det2(double,double,double,double,double&);
void det3(double,double,double,double,double,double,double,double,double,double,double,double,double,double&);
int main()
{
double a1,a2,a3,a4,a5,a6,a7,a8,a9,dReturn,dAone,dAfour,dAseven,dThree;
cout<<endl;
cout<<" Enter the nine values of the 3X3 matrix, left to right top to bottom. "<<endl;
cout<<endl;
cout<<" Enter first value. ";
cin>>a1;
cout<<" Enter second value. ";
cin>>a2;
cout<<" Enter third value. ";
cin>>a3;
cout<<" Enter fourth value. ";
cin>>a4;
cout<<" Enter fifth value. ";
cin>>a5;
cout<<" Enter sixth value. ";
cin>>a6;
cout<<" Enter seventh value. ";
cin>>a7;
cout<<" Enter eigth value. ";
cin>>a8;
cout<<" Enter ninth value. ";
cin>>a9;
cout<<endl;
NaN = the value of a calculation couldn't be represented by a double. Either an overflow, and underflow, etc.
Some NaNs aren't quite; they cause exceptions (e.g. divide by zero). = (signalled) NaN.
Andy
P.S. Do you know what a struct is? If not, laying out your code a bit better might help you spot problems.