mellonamin Member Posts: 119 From: Maryville, TN, United States Registered: 11-16-2004 |
Can someone tell me what is wrong with this code???
In function `void enter_game()': And then these warnings: destructor needed for 'std::string password'
------------------ |
Briant Member Posts: 742 From: Stony Plain, Alberta, Canada Registered: 01-20-2001 |
I'm not sure what compiler you're using, but they will handle the problem differently. The problem is basically that case 1 is in the same "scope" as case 2, and that your variable "password" has its initialization skipped if the case 2 code is executed (even though "password" isn't used there. There are two simple adjustments you can make to get around this: 1. move your "string password" outside of the switch statement (ie. put it with "string name") OR 2. use squiggly brackets inside your case statements to restrict scope switch(idnumber) I hope that helps. God bless, |
mellonamin Member Posts: 119 From: Maryville, TN, United States Registered: 11-16-2004 |
That helps alot....thanks soooooo much! ------------------ |