关于scanf跟printf的提问

P1035 [NOIP2002 普及组] 级数求和

AKenclrtsM @ 2020-10-29 09:15:57

大佬们请问一下scanf跟print括号里"%"后面的字符对应什么类型的字符?


by 微分几何 @ 2020-10-29 09:19:40

对应你需要显示或读入的变量类型


by 天南星魔芋 @ 2020-10-29 09:19:44

int$ $%d long$ $long$ $%lld unsigned$ $long$ $long$ $%llu

by 微分几何 @ 2020-10-29 09:21:00

https://blog.csdn.net/qq_25548063/article/details/81448226?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.compare&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.compare@[AKenclrtsM](/user/91305)


by zjjws @ 2020-10-29 09:21:13

%d -> int
%lld -> long long
%llu -> unsign long long
%lf -> double(默认保留六位)
%.xlf -> double(保留 x位)

by zjjws @ 2020-10-29 09:21:34

一般就这些比较常用 @AKenclrtsM


by 天南星魔芋 @ 2020-10-29 09:21:40

$long$ $double$ %Lf $char$ %c $char$ 数组 %s

by zjjws @ 2020-10-29 09:22:07

第三行打错了,是

unsigned long long

by Maxmilite @ 2020-10-29 09:24:29

int \rightarrow \% d long long \rightarrow \% lld double \rightarrow \%lf char \rightarrow \%c char[] \rightarrow \%s

差不多就这些罢/kk


by Maxmilite @ 2020-10-29 09:24:58

@AKenclrtsM


by zhuzhu8127 @ 2020-10-29 10:03:30

@Maxmilite @zjjws @天南星魔芋 double 是%lf 还是%f


| 下一页