C++ Primer Plus 6.11.1

#include <iostream>
#include <cctype>
using namespace std;

int main()
{
	cout<<"==<<回显非数字输入,并转换小写为大写,转换大写为小写>>==\n\n";
	cout<<"请输入文本,@结束输入:\n";
	char ch;
	cin.get(ch);
	while(ch!='@')
	{
		if (!isdigit(ch))
		{
			if (isupper(ch))
			{
				ch=tolower(ch);
			}
			else if (islower(ch))
			{
				ch=toupper(ch);
			}
			cout<<ch;
		}
	cin.get(ch);
	}
	cout<<"再见!\n";
	return 0;
}

您可能还喜欢...

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

扫码去手机上看