A Complete Guide to Programming in C++ part 25. This book provides both novice and experienced programmers with a comprehensive resource manual for the C++ programming language. Readers gain experience in all aspects of programming, from elementary language concepts to professional software development, with in depth coverage of all the language elements en route. These elements are carefully ordered to help the reader create useful programs every step of the way. | SOLUTIONS 219 if 1 cout nEnter the password once more cin setw 20 word2 if wordl word2 Password confirmed Yes secret word1 return true return false No new password -------------------------------------------------------- Testing the functions getPassword and changePassword . After entering the password correctly max. three attempts within 60 seconds the user can change it. -------------------------------------------------------- include iostream include iomanip include string include cctype using namespace std bool getPassword void Read a password. bool changePassword void Change a password. Inline functions inline void cls cout 033 2J inline void go_on cout n nGo on with return Only new input while n inline char getYesOrNo Read character Y or N. char c 0 Just new input do c c toupper c Permitting lower case letters also. while c Y c N return c 220 CHAPTER I I ST0RAGE CLASSES AND NAMESPACES static string header n n Test password handling n n static string menu n n B Booking n n E End of program n n Your choice int main char choice 0 while choice E cls cout header menu Header and Menu choice choice toupper choice cls cout header endl Header switch choice case B Booking if getPassword cout Access denied endl go_on else cout Welcome n n Do you want to change the password y n if getYesOrNo Y if changePassword cout Password changed endl else cout Password unchanged endl go_on Place statements for booking here. break case E cls cout n Bye Bye endl break End of while return 0 chapter 12 References and Pointers This chapter describes how to define references and pointers and how to use them as parameters and or return values of functions. In this context passing by reference and read-only access to arguments are introduced. 22