E
erictham115
Hi i am a novice in C++ programming and encountered the following
problem without headway - a popout appeared after successful
compilation and linking with:
"An unhandled exception of type 'System.NullReferenceException'
occurred in rational.exe
Additional information: Object reference not set to an instance of an
object."
On pressing break, the code stopped at the fract[0] which is a private
class Rational member:
int* rational::setrational(int n, int d)
{
div_t div_result;
const int size = 3;
if (n > d )
{
div_result = div(n,d);
fract[0]= div_result.quot; --> code execution stopped here
fract[1]= div_result.rem;
fract[2]= d;
}
else
{
fract[0]= 0; <---- or here.
fract[1]= n;
fract[2]= d;
};
return fract;
Can anyone help? thanks
problem without headway - a popout appeared after successful
compilation and linking with:
"An unhandled exception of type 'System.NullReferenceException'
occurred in rational.exe
Additional information: Object reference not set to an instance of an
object."
On pressing break, the code stopped at the fract[0] which is a private
class Rational member:
int* rational::setrational(int n, int d)
{
div_t div_result;
const int size = 3;
if (n > d )
{
div_result = div(n,d);
fract[0]= div_result.quot; --> code execution stopped here
fract[1]= div_result.rem;
fract[2]= d;
}
else
{
fract[0]= 0; <---- or here.
fract[1]= n;
fract[2]= d;
};
return fract;
Can anyone help? thanks