用scanf如何读入long double和unsigned char? 语言学得不精,还请众神指点…… 网上找了一下,可是照着打不行啊。。。 以下是代码和编译信息(c++)
#include <cstdio>
int main()
{
unsigned char test;
scanf("%hhu",&test);
printf("%hhu",test);
long double a;
scanf("%Lf",&a);
printf("%lf",a);
}
1625.cpp:9:20: warning: unknown conversion type character 'h' in format [-Wformat]
1625.cpp:9:20: warning: too many arguments for format [-Wformat-extra-args]
1625.cpp:10:20: warning: unknown conversion type character 'h' in format [-Wformat]
1625.cpp:10:20: warning: too many arguments for format [-Wformat-extra-args]
1625.cpp:12:16: warning: unknown conversion type character 'L' in format [-Wformat]
1625.cpp:12:16: warning: too many arguments for format [-Wformat-extra-args]
1625.cpp:13:16: warning: format '%lf' expects argument of type 'double', but argument 2 has type 'long double' [-Wformat]
国外已经有人提过类似的问题了。 点这里