For my final, I have to do an organizational chart using linked lists. Users have to be able to add people to the list, delete people, change information, blah blah blah. The problem is the way the user enters his information. Commands are of the format (command letter)(number), or for example, "insert at line three" looks like "I3".

Right now, I am using strings to store input, and doing a switch statement based on the first character. I am then passing the second character to the relevent function.

My switch statement:
Code:
void handleinput(string input)
{
	char command=0;
	
	command = input[0];
	switch (command)
	{
	case 'I':
		chart.insert(input[1] - '0');  //only works for single digits
		break;
	case 'C':
		chart.change(input[1] - '0');
		break;
	case 'D':
		chart.del(input[1] - '0');
		break;
	case 'L':
		chart.List(cout,0);        
		break;
	case 'X':
		chart.cut(input[1]-'0');
		break;
	case 'E':
		chart.eliminate(input[1]-'0');
		break;
	case 'N':
		chart.New();
		break;
	case '?':
		chart.help();
		break;
	default:
		return;
	}
}
As you can see from my comment, there is a problem: this method only works for numbers 1-9. C23 would currently be the same as C2, because I'm only looking at the second character.

I don't know how to tokenize these strings, if it's even possible. There is NO space or other character between command and number.

If you know of a more elegant way to go about this, please help me.