/* * 输入3个字符串,按由小到大的顺序输出 */ #include<iostream> #include<string> using namespace std; void main() { void swap(char *str1,char *str2 ...
include lt stdio.h gt include lt string.h gt int main char a char b char c char t gets a gets b gets c if strcmp a, b gt strcpy t, a strcpy a, b strcpy b, t if strcmp a, c gt strcpy t, a strcpy a, c ...
2018-12-15 19:15 0 2110 推荐指数:
/* * 输入3个字符串,按由小到大的顺序输出 */ #include<iostream> #include<string> using namespace std; void main() { void swap(char *str1,char *str2 ...
输入3个字符串,要求按由小到大的顺序输出 解题思路: 字符串的比较可以使用strcmp函数,返回值>0表示大于,返回值小于0表示小于,返回追等于0表示相同。其他的比较排序思路与数字的排序交换没有区别,逐个进行比较先找出最大的,然后找出第二大的。 答案: ...
...
#include <stdio.h>#include <string.h>int main(){ char a[10],b[10],c[10],t[10]; int x,y,z ...
输入3个字符串,要求按由小到大的字母顺序输出 如 输入franch england china,输出结果是china england franch 三个数排序输出,比较三个数的大小怎么做? a=18 b= 9 c=30 a>b 交换 a=9 b=18 可不可以用选择法?可不可以 ...
include <stdio.h> include <stdlib.h> include <string.h> void swap(char** a,char** b)//输入的参数是二级指针(指针的地址) { char* temp;//对指针(内容的地址 ...
#include <stdio.h>#include <stdlib.h>int main(int argc, char *argv[]) { int a,b,i,j=0,t; ...