Clear All Variable Values

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 46
Reputation: cppnewb is an unknown quantity at this point 
Solved Threads: 0
cppnewb's Avatar
cppnewb cppnewb is offline Offline
Light Poster

Clear All Variable Values

 
0
  #1
Mar 9th, 2009
Hi. I have a program that goes a little like this:

// Include files, etc...

int main()

//code...


if (input == "logout");
{
    return main();
}


// rest of the code

Now, every time the program goes to main, the values previously stored in the varibles are still there. I am looking for a way to start with a clean slate and wipe all of the variables.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Clear All Variable Values

 
0
  #2
Mar 9th, 2009
Just reset the variables to an empty string

input = "";
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 476
Reputation: nucleon has a spectacular aura about nucleon has a spectacular aura about 
Solved Threads: 91
nucleon's Avatar
nucleon nucleon is offline Offline
Posting Pro in Training

Re: Clear All Variable Values

 
0
  #3
Mar 9th, 2009
You probably shouldn't be "going to main". Remove the return main(); part and change it to a loop.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC