an option at the end of this prog to ask if I want to run again
I am wanting to put an option at the end of this prog to ask if I want to run again or exit how would i go about doing this
i have already tried this below
Thanks for your help
This is what i tried
((((
std::cout<<"\nall done?";
bool yn;
std::cin>>yn;
if (yn==n)
goto z;
else if
return 0;
}
Start of real prog!!!!!!!
#include<iostream>
int main()
{
z:
int area, volume, height, width, length, sphere, circ, vols, pi, y, n ;
pi = 3.14159265;
std::cout<<"\nDo you wish to calculate Area or Volume or vol of Sphere?(A/V/S)";
char avs;
std::cin>>avs;
if (avs == 'a')
{
//input and calculate area
std::cout<<"\ninput width in inches:";
std::cin>>width;
std::cout<<"\ninput length in inches:";
std::cin>>length;
area=length*width;
std::cout<<"\narea is:";
std::cout<<area;
std::cout<<" Square Inches";
}
else if (avs == 'v')
{
//input and calculate volume
std::cout<<"\ninput width in inches:";
std::cin>>width;
std::cout<<"\ninput height in inches:";
std::cin>>height;
std::cout<<"\ninput length in inches:";
std::cin>>length;
volume=height*width*length;
std::cout<<"\nvolume is:";
std::cout<<volume;
std::cout<< " Cubic Inches";
}
else if (avs == 's')
{ //input and calculate circumfrence
std::cout<<"\n input diameter/2 or radius";
std::cin>>sphere;
vols = 4*pi*(sphere*sphere);
circ = (2*sphere)*pi;
std::cout<<"\narea is:";
std::cout<<vols;
std::cout<< "Cubic inches";
std::cout<<"\nby the way the circumfrence is";
std::cout<<circ;
std::cout<< " Inches";
}
return 0;
}