hey guys... I wanna know how i would get a "would you like to start again? Y or N?" message to pop up at the end of my program and have it start from the beginning is the input is Y or y and to close if the unput is N or n..
#include <cstdlib>
#include <iostream>
#include <cmath>
usingnamespace std;
int main(int argc, char *argv[])
{
system("TITLE Pythagoren theorem solver - BY: Matthew Goulart - 2008");
system("COLOR 8");
char loop = 'y';
double a;
double b;
double H;
cout<<"Welcome to the PYTHAGOREAN THEOREM problem solver by Matthew Goulart." <<endl;
cout<<"Enter the 'a' and 'b' variables and press return!."<<endl<<endl;
cout<<"=====================PYTHAGOREAN THEOREM problem solver====================="<<endl<<endl;
cout<<"What is the value of A?: ";
cin>> a;
cout<<"what is the value of B?: ";
cin>> b;
cout<<"The length of the hypotenuse is: ";
H=sqrt(pow(a,2)+pow(b,2));
cout<<H <<endl;
if(a<=0)
{
cout<<"SIDE A IS INVALID! (no negatives)"<<endl<<endl;
}
else
{
if(b<=0)
{
cout<<"SIDE B IS INVALID! (no negatives)"<<endl<<endl;
}
else
{
if(H>0)
{
cout<<"Equation successeful! "<<endl<<endl;
}
}
}
system("PAUSE");
return 0;
}
Well, thanks firstly for the quick response, but unfortunately, it is my very first day with C++ (not programming mind you) and you left a bit too much of my own code out for me to be able to find my way around... Wich is good, if you could explain, in the greatest detail possible, exactly what i am supposed to do instead of giving me the answer, I would be very greatful!