规范输入

标签(空格分隔): c


/***************************************
FUNCTION: getlet
DESCRIPTION: select a character from a given string
INPUT: 
	string s: means you can select a character from this string 
OUTPUT:  
RETURN: 
	char c: what you have selected in given string
OTHER: 
***************************************/
char getlet(const char * s)
{
	char c;
	
	c = getchar();
	while (strchr(s, c) == NULL)
	{
		printf ("Enter a character in the list %s
", s);
		while( getchar() != '
')
			continue;
		c = getchar();
	}
	while (getchar() != '
')
		continue;
		
	return c;
}
原文地址:https://www.cnblogs.com/puliuyinyi/p/6032074.html