Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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.

  • You cannot reply to this topic
1 reply to this topic

#1 tkitts1965   Members   -  Reputation: 122

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<

Sponsor:

#2 Ironblayde   Members   -  Reputation: 130

Posted 08 October 2000 - 06:28 AM

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




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.



PARTNERS