源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

输入3个字符串,将它们按照字母由大到小排序(示例代码)

  • 时间:2021-03-02 11:27 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:输入3个字符串,将它们按照字母由大到小排序(示例代码)
用string方法定义字符串变量 实现代码:
[u]复制代码[/u] 代码如下:
#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;  }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部