首页 > 其他 > 详细

PAT乙级 (1033 旧键盘打字 (20分)(字母大小写转换、判断是否为大小写字母数字))

时间:2020-01-27 22:18:28      阅读:114      评论:0      收藏:0      [点我收藏+]

1033 旧键盘打字 (20分)

https://pintia.cn/problem-sets/994805260223102976/problems/994805288530460672

字母的大小写转换:(头文件:#include <cctype>)

小写转大写:toupper()

大写转小写:tolower()

判断:

是否为字母: isalpha()

是否为数字: isdigit()

是否为大写字母:  isupper()

是否为小写字母:  islower()

#include <iostream>
#include <cstdio>
#include <cctype>
using namespace std;
int main()
{
	string str1,str2;
	getline(cin,str1);
	getline(cin,str2);
	for(int i=0;i<str2.length();i++)
	{
		if(str1.find(toupper(str2[i]))!=string::npos) continue;
		if((isupper(str2[i]))&&(str1.find(‘+‘)!=string::npos)) continue;
		cout<<str2[i];
	}
	return 0;
}

PAT乙级 (1033 旧键盘打字 (20分)(字母大小写转换、判断是否为大小写字母数字))

原文:https://www.cnblogs.com/jianqiao123/p/12236965.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!