On Thu, Jun 4, 2009 at 7:39 PM, benjamin_cail_scott <[email protected]> wrote: > --- In [email protected], Paul Herring <pauljherr...@...> wrote: > > > //the recursive type > > > void ask_stuId(){ > > > string userInput; > > > cout<<"Enter your full student Id"<<endl; > > > getline(cin,userInput); > > > if(isMatch_strFormat(userInput,"aaa/####/###")) > > > stuId=userInput; > > > else { > > > cout<<"In correct format, "; > > > ask_stuId(); > > > > Bad, and certainly not efficient compared to your loop version. > > The user could just keep entering rubbish, and each time they do, > > some more memory is taken up to store the next invocation of the > > function. > > You know If you Send the Address of the Varible > that is Accepting the information that would > minimize memory usage.
No it wouldn't. You still have the overhead of the function call stored on 'the stack' each iteration. -- PJH http://shabbleland.myminicity.com/com http://www.chavgangs.com/register.php?referer=9375
