/* * 輸入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; ...