0
如何把字符转换为整形变量呢?列出程序的~急求帮忙~😭I need help😲
6 Answers
+ 1
Even though there might be some Chinese guys in the forum you unnecessarily restrict yourself to a relatively small subgroup of all people here, if you stick to Chinese. Try asking in English. This gives you access to many more potential people that can help you and you might learn and improve your English, too.
+ 1
we need help too 😛
+ 1
Jop, so you are not only restricting your potential helpers only writing in Chinese, you also partition this forum into language subgroups. If this would get commonly accepted I only answer in German on every question I understand. >:)
0
如果是这样的字符'2',你要获得整数2,可以用int n = atoi('2')得到;如果只是要获得ASCII码,可以这样int n = '2';printf(“%d\n”, n);会打印出它的ASCII码50。
0
C++ 可以进行自动类型转换,你把字符赋值给一个整形就行了,简单粗暴。
0
Thanks