我正在尝试打印符号的整数等价物;:?. 和空格,但它不起作用。
printf( "Following symbols ending with a whitespace: - = + / \ ; : ? . [whitespace]\n" );
printf( "%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", '-', '=', '+', '/', '\', ';', ':', '?', '.', ' ' );
Run Code Online (Sandbox Code Playgroud)
我已经成功打印了 AZ、az、0-20 和其他符号的整数等价物。但是,当我尝试编译此行时,从分号到右侧的符号似乎存在问题。我从 VS 2019 的命令提示符中收到以下错误。
IntegerValueOfChar.c(29): warning C4129: ' ': unrecognized character escape sequence
IntegerValueOfChar.c(31): error C2143: syntax error: missing ')' before 'constant'
IntegerValueOfChar.c(31): warning C4473: 'printf' : not enough arguments passed for format string
IntegerValueOfChar.c(31): …Run Code Online (Sandbox Code Playgroud) float a, b, c;
printf( "Enter three nonzero values:\n" );
scanf( "%f%f%f", &a, &b, &c );
Run Code Online (Sandbox Code Playgroud)
当我输入 a = 2、b = 2 和 c = 4 时,为什么...
if( a < ( b + c ))
{
if( b < ( a + c ))
{
if( c < ( a + b ))
{
printf( "This is a triangle." );
}
else
{
printf( "This is not a triangle." );
}
}
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
...打印“这不是三角形”但是...
if( a < …Run Code Online (Sandbox Code Playgroud)