3392:【例68.3】 忽略大小写的字符串比较

830 篇文章 36 订阅
650 篇文章 3 订阅

3392:【例68.3】 忽略大小写的字符串比较

信息学奥赛一本通-编程启蒙(C++版)在线评测系统

[例 68.3] 忽略大小写的字符串比较

信息学奥赛一本通-编程启蒙(C++版)在线评测系统

3392:【例68.3】 忽略大小写的字符串比较_哔哩哔哩_bilibili




C++程序:

/*
1.7编程基础之字符串_16忽略大小写的字符串比较02
http://noi.openjudge.cn/ch0107/16/ 
*/
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	//freopen("input.txt","r",stdin);
	string s1,s2;
	
	getline(cin,s1);
	getline(cin,s2);
	
	transform(s1.begin(),s1.end(),s1.begin(), ::toupper);
	transform(s2.begin(),s2.end(),s2.begin(), ::toupper);
	
	if (s1>s2) 		cout<<">";
	else
	{
		if (s1<s2) 	cout<<"<";
		else 		cout<<"=";
	}
	
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s1,s2;
	getline(cin,s1);
	getline(cin,s2);
	transform(s1.begin(),s1.end(),s1.begin(),::toupper);
	transform(s2.begin(),s2.end(),s2.begin(),::toupper);
	if(s1>s2) cout<<">";
	else if(s1==s2) cout<<"=";
	else cout<<"<";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	string str,xyz;
	int num=0;
	cin>>str>>xyz;
	
	for(auto i:str)
	{		
		if( i>='A' && i<='Z' )
		{
			str[num]+=32;
		}
		
		num++;
	}
	
	num=0;
	
	for(auto i:xyz)
	{		
		if( i>='A' && i<='Z' )
		{
			xyz[num]+=32;
		}
		
		num++;
	}
	
	if( str>xyz )
	{
		cout<<">"<<endl;
	}
	
	if( str==xyz )
	{
		cout<<"="<<endl;
	}
	
	if( str<xyz )
	{
		cout<<"<"<<endl;
	}
	
	return 0;
}



 




3012:练4.1 阿布拉1(Scratch、C、C++、python)

3012:练4.1 阿布拉1(Scratch、C、C++、python)_尼克是一位好学的学生,他经常做实验。有一天他在做实验的时候需要交换一瓶 毫升的-CSDN博客

Python信息技术学考一本通题目讲解、python入门、python习题集整理汇总等

Python信息技术学考一本通题目讲解、python入门、python习题集整理汇总等 - 哔哩哔哩

Python信息技术学考一本通题目讲解

Python信息技术学考一本通题目讲解_哔哩哔哩_bilibili

Python等级考试(1级-6级)全套真题讲解| 2023年3月

Python等级考试(1级-6级)全套真题讲解| 2023年3月_哔哩哔哩_bilibili

用Python学习数学系列

用Python学习数学系列_哔哩哔哩_bilibili

电子学会python三级考试知识点讲解教学视频

电子学会python三级考试知识点讲解教学视频_哔哩哔哩_bilibili

跟着兔子一起研究学习,【Python基础- Python及其数学库】上

跟着兔子一起研究学习,【Python基础- Python及其数学库】上_哔哩哔哩_bilibili

蓝桥STEMA竞赛Python模块(23年10月)

蓝桥STEMA竞赛Python模块(23年10月)_哔哩哔哩_bilibili

NOI题库 python题解

https://blog.csdn.net/dllglvzhenfeng/category_11601976.html

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dllglvzhenfeng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值