(C,C++)求一函数,字符串排序(A01,A2,A3,A1)

来源:百度知道 编辑:UC知道 时间:2024/07/07 18:23:07
如题.
简述功能:输入两个字符串,如A01,A1,比较结果为 A01,A1,算是混合排序吧...
实在写不出,求大虾给源码.....

#include<iostream>
#include<string>
using namespace std;
void main()
{
char* s1 = "A10 ";
char* s2 = "A11";
char a[20];
cout << (s1>s2 ? "":"not")<< "equal"<< endl;
}
这样应该可以比较吧,c++系统还提供一些其他字符串的函数,如:strcpy(字符串复制),strcat(字符串连接),strcmp(字符串比较),strchr(字符串中找字符)