Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

C++ help needed

This topic is 6435 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

OK I am stuck how do I make my program continue indefinitely? With out writing it over and over. I want it to function until I tell it to stop. I can make it repeat once, I want it to repeat indefinitely. #include double sqrt (double a, double b) { return 0; } double sqrt( int a, int b, int c ) { cout< #include #include #include #include void main( void ) { srand(time(0)); cout<<"\t********************************************************\n" <<"\t* *\n" <<"\t* The Pythagorean Theorem *\n" <<"\t* *\n" <<"\t********************************************************\n\n"; double a,b,c; cout<<"Please enter two numbers:"<> a; cout<<"\nSecond number: "; cin>> b; cout<<"\n"; c=sqrt(a,b); cout<<"\n"; c=sqrt(a*a+b*b); //a2 + b2 = c2 cout<>choice1; //playing } while((choice1!=''Y'') && (choice1!=''y'') && (choice1!=''N'') && (choice1!=''n'')) { cout<>choice1; } if ((choice1 == ''Y'') || (choice1 == ''y'')) //If yes, start over again { cout<> a;cout<<"\nSecond number: "; cin>> b; cout<<"\n"; c=sqrt(a,b); cout<<"\n"; c=sqrt(a*a+b*b); cout<

Share this post


Link to post
Share on other sites
Advertisement
Well. You just use a loop!

do
{
// your code here
// get ''y'' or ''n'' from user
} while (ch == ''y'');

I strongly suggest that you pick up a book on basic C. And for programming help, post in "Game and General Programming" rather than this forum -- it''s not the place for it.

-Ironblayde
 Aeon Software

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!