ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

格式化输入输出

格式化输入输出

1.C语言的输入输出格式

输入格式:scanf("格式控制符"变量地址)格式控制符的作用是需要输入的值按规定输入。取地址符:&

数据类型 格式符 举例
int %d int n;scanf("%d",&n)
float %f flaot n;scanf("%f"&n;)
double %lf double n;scant("%lf",&n)
数据类型 格式符 举例
int %d int n=2;scanf("%d",&n)
float %f flaot n=2.3;scanf("%f"&n;)
double %lf double n4.67;scant("%lf",&n)
返回列表