OpenJudge 1.2编程基础之变量定义、赋值及转换 07:打印ASCII码

Description

Enter a visible character other than a space (guaranteed to be read in by the format specifier %c in the function scanf), and output its ASCII code.

Input

A visible character other than a space.

Output

A decimal integer, the ASCII code of the character.

Input sample

A

Output sample

65

Answer

C++
1
2
3
4
5
6
7
8
9
10
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
char c;
scanf("%c",&c);
printf("%d",int(c));
return 0;
}

Result

Used memory: 200kB
Run time: 0ms
Language:G++
Submit time:2021-04-20 10:23:05

http://noi.openjudge.cn/ch0102/07/

OpenJudge 1.2编程基础之变量定义、赋值及转换 07:打印ASCII码

https://blog.tsinbei.com/archives/541/

文章作者
Hsukqi Lee
发布于

2022-07-03

修改于

2022-07-28

许可协议

CC BY-NC-ND 4.0

# 编程  Cpp  OpenJudge  NOI  NOIP

评论

昵称
邮箱
网址
暂无