3241:【例40.2】 蜗牛字母

3241:【例40.2】 蜗牛字母

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

[例40.2] 蜗牛字母

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




C程序:

#include <stdio.h>
#include <stdlib.h>

int main()
{
	char ch;
	int ans;
	
	scanf("%c",&ch);

	ans=ch;
	
	if( ch>='a' && ch<='z' )
	{
		ch=ans-32;
		printf("%c\n",ch);
		return 0;
	}
	
	if( ch>='A' && ch<='Z' )
	{
		printf("%d\n",ans);
		return 0;
	}
	
    return 0;
}


C++源代码:

/*
3241:【例40.2】 蜗牛字母
http://bas.ssoier.cn:8086/problem_show.php?pid=3241
*/
#include <bits/stdc++.h>
using namespace std;
int main( void )
{
	char ch;

	ch=getchar();
	
	if( ch<='Z' && ch>='A')
	{
		cout<<(int)ch<<endl;
	}
	
	if( ch<='z' && ch>='a')
	{
		cout<<(char)(ch-('a'-'A'))<<endl;
	}
		
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	char b;

	cin>>b;

	if(b>='a'){
		b-=32;
		cout<<char(b);
	}
	else{
		cout<<int(b);
	}

	return 0;
}


#include<iostream>
using namespace std;
int main(){
	char a;
	cin>>a;
	if(a>='A'&&a<='Z'){
		cout<<int(a); 
	}else if(a>='a'&&a<='z'){
		cout<<char(int(a)-32);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	char ch;
	int ans;
	cin>>ch;
	ans=ch;
	
	if( ch>='a' && ch<='z' )
	{
		ch=ans-32;
		cout<<ch<<endl;
		return 0;
	}
	
	if( ch>='A' && ch<='Z' )
	{
		cout<<ans<<endl;
		return 0;
	}
	
    return 0;
}



 




循环!循环!循环!——洛谷#P1424 小鱼的航程(Python实现)

循环!循环!循环!——洛谷#P1424 小鱼的航程(Python实现)_小鱼的航程python-CSDN博客

数组——洛谷#P1428 小鱼比可爱(Python实现)

数组——洛谷#P1428 小鱼比可爱(Python实现)_小鱼比可爱python语言-CSDN博客

洛谷 python P1434 [SHOI2002] 滑雪

洛谷 python P1434 [SHOI2002] 滑雪-CSDN博客

洛谷题目 python 题解 p1442

洛谷题目 python 题解 p1442_洛谷python题目解答-CSDN博客

洛谷 P1563 python 玩具谜题

洛谷 P1563 python 玩具谜题_p1563洛谷 python-CSDN博客

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

dllglvzhenfeng

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

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

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

打赏作者

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

抵扣说明:

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

余额充值