华为OJ平台试题 —— 字符串:图片整理

图片整理

华为OJ平台试题 —— 字符串:图片整理_第1张图片


代码:

#include
#include


int main(void)
{
	char str[1024];
	int i, j, len;
	
	gets(str);
	
	len = strlen(str);

	for( i = 0; i < len; i++)
		for( j= i; j < len; j++)
		{
			if (str[i] > str[j])
			{
				char temp;
				temp = str[i];
				str[i] = str[j];
				str[j] = temp;
			}
		}
		
	printf("%s\n", str);
	
} 


你可能感兴趣的:(华为机试)