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

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;
}
posted @ 2020-01-27 21:42  yyer  阅读(200)  评论(0编辑  收藏  举报