手机
当前位置:查字典教程网 >编程开发 >C语言 >输入3个字符串,将它们按照字母由大到小排序(示例代码)
输入3个字符串,将它们按照字母由大到小排序(示例代码)
摘要:用string方法定义字符串变量实现代码:复制代码代码如下:#include#includeusingnamespacestd;intmai...

用string方法定义字符串变量

实现代码:

复制代码 代码如下:

#include<iostream>

#include<string>

using namespace std;

int main(){

string a,b,c,t;

cout<<"please input first string:"<<endl;

cin>>a;

cout<<"please input second string:"<<endl;

cin>>b;

cout<<"please input third string:"<<endl;

cin>>c;

if(a>b){

t=a;

a=b;

b=t;

}

if(a>c){

t=a;

a=c;

c=t;

}

if(b>c){

t=b;

b=c;

c=t;

}

cout<<a<<"<<"<<b<<"<<"<<c<<endl;

return 0;

}

【输入3个字符串,将它们按照字母由大到小排序(示例代码)】相关文章:

C/C++实现矩阵的转置(示例代码)

递归法求最大公约数和最小公倍数的实现代码

字符串中找出连续最长的数字字符串的实例代码

c语言冒泡排序法代码

C 字符串数组排序的小例子

基于C语言字符串函数的一些使用心得

新旧MFC版本实现CEdit透明的2种方法的实例代码

虚函数被类的构造析构函数和成员函数调用虚函数的执行过程

最长公共子字符串的使用分析

c语言字符数组与字符串的使用详解

精品推荐
分类导航