Hello, I'm studying C++ by two months using the book : programming principles and practice using C++, I'm on chapter 5 now studying error reporting. The author in this chapter uses this example to show to the readers the run time errors.

Code:
 #include "std_lib_facilities"

    int area(int length, int width)
    {

    return length*width;

    }

    int framed_area(int x, int y)
    {

    return area(x - 2, y - 2);

    }

    int main()
    {

    int x = -1;
    int y = 2;
    int z = 4;

    
    int area1 = area(x, y);

    int area2 = framed_area(1, z); 
    int area3 = framed_area(y, z); 

    }


this code produces a run-time error due to the division of area1 with 0.
Subsequently, the author introduces a facilitation contained in the header file which he wrote called error (). My problem is that when this function call should produces a system error over a string literal that we passed as an argument to the function, instead my program code at runtime produces a screen that reports:


>> Microsoft visual C++ runtime library

>> debug error!
>> program:..dio
>> 2013\Projects\learnprogramming\Debug\learnprogramm ing.exe
>> abort() has been called

What could be happened ? is this a problem of the function implementation ?

I thought that there was something wrong with this program so I decided to write a simple selection program using error() but it produced the same errors.

for example :

Code:
int main ()
{

int n = 0; 

cout << "Enter a positive value "; 
cin >> n; 

if(n >0)
cout << "Ok\n"; 
else error ("not a positive value"); 
}
I am just wondering if the message I get is normal ?