Exception handling problem(password and string thingy)

The program is working correctly when I put the pin correctly but when I put different pin this is the output
http://www.tiikoni.com/tis/view/?id=d340a8b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
void askPin()
{
	system("cls");
	string pin="";
	char ch;
	cout<<"Enter your 4-digit PIN: ";
	bool code = true;
	 
	while(code)
	{
		while(ch!='\r')
		{ 
			ch=_getch(); 
			if(ch=='\b')
			{ 
				if(pin.size()!=0)
				{ 
					cout <<"\b \b"; 
					pin.erase(pin.size()-1, 1); 
				} 
				continue; 
			} 
			else if(ch<='9' &&ch>='0'|| ch >='a'&& ch<='z'||ch>='A' && ch<='Z')   
			{ 
				pin+=ch; 
				cout<<"*"; 
			} 
			else
				continue; 
		} 
		try{
			if(pin!=currentPin)
				throw pin;
		}
		catch(string p)
		{
			cout<<"Invalid PIN, please enter again.\n";
			continue;
		}//end catch
		code=false;
	}//end while
}//end askPin 
Topic archived. No new replies allowed.