题目:
字符串排序。调用Input函数输入10个字符串,调用Sort函数对这10个字符串按字典顺序排序,调用Print函数打印输出排序后的字符串。 Input函数原型: void Input(char str[][80],int n); Sort函数原型: void Sort(char str[][80],int n); Print函数原型: void Print(char str[][80],int n); ***输入数据格式:读入可包含有空格的字符串(字符串最大长度80) ***输出数据格式: 一行输出一个字符串
代码如下:
#include#include #define N 10 void Input(char str[][80],int n); void Sort(char str[][80],int n); void Print(char str[][80],int n); int main() { char a[N][80]; Input(a,N); Sort(a,N); Print(a,N); return 0; } void Input(char str[][80],int n) { for(int i=0;i 0) { strcpy(temp,str[j]); strcpy(str[j],str[j+1]); strcpy(str[j+1],temp); } } } } void Print(char str[][80],int n) { for(int i=0;i 欢迎评论交流



