• Create Account

## C++ help needed

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1tkitts1965  Members

Posted 08 October 2000 - 04:32 AM

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<

### #2Ironblayde  Members

Posted 08 October 2000 - 06:28 AM

Well. You just use a loop!

do
{
// 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

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.