是否有返回字符的ASCII值的功能? (C ++) [英] Is there a function that returns the ASCII value of a character? (C++)
本文介绍了是否有返回字符的ASCII值的功能? (C ++)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要返回字符,包括空格,制表符,换行符,等等...
的ASCII值的函数在一个类似的说明,什么是十六进制,十进制和二进制数之间进行转换的功能?
解决方案
字符℃;
INT ASCII =(INT)C;
s2.data [J] =(char)的计数;
一个字符的是一个整数,无需转换功能。
也许您正在寻找显示整数作为字符串函数 - ?使用十六进制,二进制或十进制重新presentations
I need a function that returns the ASCII value of a character, including spaces, tabs, newlines, etc...
On a similar note, what is the function that converts between hexadecimal, decimal, and binary numbers?
解决方案
char c;
int ascii = (int) c;
s2.data[j]=(char)count;
A char is an integer, no need for conversion functions.
Maybe you are looking for functions that display integers as a string - using hex, binary or decimal representations?
这篇关于是否有返回字符的ASCII值的功能? (C ++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文