所以,我开始调试,通过这么多的代码,
#include <cmath>
#include <string>
#include <iostream>
using namespace std;
int main()
{
double radius,width,length,height,area,base;
int shape;
const double pi =3.14159;
cout<< "Please choose from the following menu. \n"
"Geometry Calculator \n"
"1. Calculate the Area of a Circle \n"
"2. Calculate the Area of a Rectangle\n"
"3. Calculate the Area of a Triangle\n"
"4. Quit\n";
cin>>shape;
if(shape>4 || shape < 1)
{
cout<<"Your selection was not acceptable.\n\a\a"
"Please choose from the following menu. \n"
"Geometry Calculator \n"
"1. Calculate the Area of a Circle \n"
"2. Calculate the Area of a Rectangle\n"
"3. Calculate the Area of a Triangle\n"
"4. Quit\n";
}
switch (shape)
{
case '1':
cout<<"What is the radius of the circle?\n";
cin>>radius;
if(radius<0)
{
cout<<"Please enter a non-negative radius.\n\a";
cin>>radius;
}
area = pow(radius,2) * pi;
cout<<"Your circle has an area of " <<area<<".";
break;
case '2':
cout<<"What is the width of the rectangle?\n";
cin>>width;
if(width<0)
{
cout<<"Please enter a non-negative width.\n\a";
cin>>width;
}
cout<<"What is the length of the rectangle?\n";
cin>>length;
if(length<0)
{
cout<<"Please enter a non-negative length.\n\a";
cin>>length;
}
area = length * width;
cout<<"The area of your rectangle is " <<area<<".\n";
break;
case '3':
cout<<"What is the base of the triangle?\n";
cin>>base;
if(base<0)
{
cout<<"Please enter a non-negative base measurement.\n\a";
cin>>base;
}
cout<<"What is the height of the triangle?\n";
cin>>height;
if(height<0)
{
cout<<"Please enter a non-negative height measurement.\n\a";
cin>>height;
}
area = base*height*.5;
cout<<"Your triangle's area is "<<area<<".\n";
break;
}
}
等等-我认为它实际上停在cin
. 调试窗口突然关闭,然后这是发生这种情况时输出窗口中显示的内容:
'heather t chapter 4 21.exe' (Win32): Loaded 'C:\Users\Heather\Documents\Visual Studio 2012\Projects\heather t chapter 4 21\Debug\heather t chapter 4 21.exe'. Symbols loaded.
'heather t chapter 4 21.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'heather t chapter 4 21.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'heather t chapter 4 21.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'heather t chapter 4 21.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded.
'heather t chapter 4 21.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded.
The program '[3800] heather t chapter 4 21.exe' has exited with code 0 (0x0).
世界上正在发生什么,我该如何解决?