943,513 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 7402
  • C++ RSS
Mar 9th, 2009
0

Clear All Variable Values

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cppnewb is offline Offline
52 posts
since Jan 2009
Mar 9th, 2009
0

Re: Clear All Variable Values

Just reset the variables to an empty string

input = "";
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Mar 9th, 2009
0

Re: Clear All Variable Values

You probably shouldn't be "going to main". Remove the return main(); part and change it to a loop.
Reputation Points: 163
Solved Threads: 91
Posting Pro in Training
nucleon is offline Offline
476 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Deque
Next Thread in C++ Forum Timeline: c++ to Mathematics





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC