我查了iso_8859-1的手册,找到了度数符号:
Oct Dec Hex Char Description
260 176 B0 ° DEGREE SIGN
代码:
int main( int argc, char *argv[])
{
char chr = 176; //stores the extended ASCII of a symbol
printf("Character with an ascii code of 251: %c \n", chr);
return 0;
}
但它打印出来为
?
.如何在 C 程序中输出学位符号?我需要包含一些文件吗?
最佳答案
摄氏度的 ASCII 代码是 248。您可以将其声明为 C 中的字符。
#include<stdio.h>
void main()
{
char ch=248;
printf("Today's temperature was 23%cC",ch);
}
关于c - 如何使用iso_8859-1在C程序中输出度数符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33188044/