I have a question, my code doesn't work right, I try to put in a break, so it understands to go to the next case, but it doesn't do anything...Does anyone know how to make it run so that the Username enter in correctly and run the rest of my program.


P.S. - When I put breaks on every like, I get a runtime termination error, which made me sad:(

for (i=0; i<5; i++)
		switch (i)
			case 0: fix = 0146; username = fix; c = 1;			//102 - f
			case 1: fix = 0156; username.insert (c++,fix);	//110 - n
			case 2: fix = 0141; username.insert (c++,fix);	  //97  - a
			case 3: fix = 0162; username.insert (c++,fix);		//114 - r
			case 4: fix = 0153; username.insert (c++,fix);	//107 - k
			default: fix = 0154; username.insert (c++,fix); break;	//108 - l
	username.replace (7,1,"");

	// cout << username;

		cout <<"Enter Username to Enter: ";
		cin >> input;
	} while (input != username);

how are fix and username declared? I would presume from the name of the variable that username is a character array. Then why are you assining an integer to a character array? Doesn't make sense.

If you want to debug that switch statement it is easier if you put those statements on separate lines, like this:

case 0:
    fix = 1046;
    username = fix;
    c = 1;

The second problem with that switch statement is that there are no break statements to prevent executing all those statements. For example: if case 0 is executed the program will also execute all the other cases because there are not breaks. See the example I posted above.

they are initialized in the beginning

string username;
	string fix;
	string input;

if fix is a string then how on earth do you expect this to work: fix = 0146; ???? what are you trying to do here ?

I'm trying to use Hexidecimal to create a password, so the numbers are Hex which equal letters. Then you use the letters to solve for the password.