Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If a condition is met, clear the screen and restart the program?

Status
Not open for further replies.

Flanamacca

Programmer
Mar 11, 2003
3
AU
I want it so that when a condition is met, the program proceeds to clear the screen (dos based window) and start anew
 
you can clear the screen by using this:

#include<stdlib.h>
....
system(&quot;cls&quot;);
 
Do the system(&quot;cls&quot;); like Leibnitz said.

If you want it to basically restart the program if a certain condition is met, do this. Set done to false if you want it to start over.

BOOL done = FALSE;

while(done == FALSE)
{
system(&quot;CLS&quot;);
// put whatever other code you need in here
}

This will redo the meat of your program, and clear the screen every time you start the while loop over.
 
I'm trying to set a conditional break point using the Visual Studio Debugger for Visual C++. I set the breakpoint and then I attempt to set a condition by going to the Edit, Breakpoints.... menu. I locate my breakpoint and click on the &quot;Condition...&quot; button. I enter a condition similar to strcmp(var,&quot;someliteral&quot;) == 0, but when I try to click OK for the edit breakpoints dialog, I get a message telling me it cannot set the breakpoint. I've #include'd <string.h> and the var is within the scope of the breakpoint. If I put a simple express like var == 'c' that works. It seems not to like function calls, but I thought strcmp(var,&quot;some literal&quot;) == 0 qualified as an expression.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top