手机
当前位置:查字典教程网 >编程开发 >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语言中if 语句的作用范围示例代码

C语言小程序 计算第二天日期示例代码

C字符串与C++字符串的深入理解

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

深入C中常用的三种排序方法总结以及探讨分析

C++输入一个字符串,把其中的字符按照逆序输出的两种方法解析

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

c语言冒泡排序法代码

求子数组最大和的实例代码

精品推荐
分类导航