Home > Back-end >  .exe triggered a breakpoint, how to do for help, the main function can't change
.exe triggered a breakpoint, how to do for help, the main function can't change

Time:12-03

//define a base class Shape, on the basis of the derived a Rectangle and Circle, both getArea () function to calculate the area of the object, using a Rectangle class to create a derived class Square, please complete the following procedures,//Hint//1, the Rectangle is long and wide two data members of the class, in the Circle in the class has a data member of the radius, the subject of PI//2, use 3.14
#include
using namespace std;
#include
The class Shape {
Public:
Virtual float getArea ()=0;
Virtual ~ Shape () {}};
The class Circle: public Shape
{public:
Int r;
Public:
Circle (int r)
{this - & gt; R=r. }
Virtual float getArea ()
{return (float) 3.14 * r * r; }
};
Class a Rectangle: public Shape
{public:
Int length;
Int wide; Public:
A Rectangle (int length, int wide)
{
This - & gt; Length=length;
This - & gt; Wide=wide; }
Virtual float getArea ()
{return (float) length * wide; }
};
The class Square: public Rectangle
{public:
Square (int wide) : a Rectangle (wide, wide)
{}
Virtual float getArea () {
Return (float) wide * wide; }
};//your code will be embedded in here
Int main ()
{Shape * ps; Ps=new Circle (5);
Cout & lt; <"The area of The Circle is" & lt; Delete the ps;
A Rectangle * pr;
Pr=new Rectangle (5, 6);
Cout & lt; <"The area of The Rectagle is" & lt; The delete pr;
Square s (8);
Pr=& amp; s;
Cout & lt; <"The area of The Square is" & lt; The delete pr;
return 0;
}
//Output://Sample Output
The area of The Circle is 78.5
The area of The Rectagle is 30
The area of The Square is 64

CodePudding user response:

Linux:
Process exit would have a "core" in the current directory files or form such as' core. The digital files such as' core. 1234 '
Using the command
GDB to run the program of the core or the core. The digital
Enter the GDB and then use the bt command
Can view the process exit before the function call stack, content is from the top to the following out of from the inner to outer function call history,
If process exit does not produce the core file, the reference "ulimit -c size the most large core file" command

Windows:
Collapsed in the pop-up dialog box, press the corresponding button to enter debugging press Alt + 7 key to view the Call Stack, namely "the Call Stack" from the inside to the following out of from the inner to outer function Call history, double-click a row to the cursor to the Call of the source code or assembly instruction, don't understand when double click on the next line, until we can read ,

CodePudding user response:

reference 1/f, zhao teacher reply:
Linux:
Process exit would have a "core" in the current directory files or form such as' core. The digital files such as' core. 1234 '
Using the command
GDB to run the program of the core or the core. The digital
Enter the GDB and then use the bt command
Can view the process exit before the function call stack, content is from the top to the following out of from the inner to outer function call history,
If process exit does not produce the core file, the reference "ulimit -c size the most large core file" command

Windows:
Collapsed in the pop-up dialog box, press the corresponding button to enter debugging press Alt + 7 key to view the Call Stack, namely "the Call Stack" from the inside to the following out of from the inner to outer function Call history, double-click a row to the cursor to the Call of the source code or assembly instruction, don't understand, until can read ,

Changed, the last step error, the program will not automatically end at the end
  • Related