printf函数内部的%d说明符表示我们将变量显示为十进制整数,%f说明符会将其显示为浮点数,依此类推。但是%di说明符是做什么用的?
我在该程序中找到了这个说明符(C程序用于对复数进行加,减,乘和除运算,复数运算)
例如,
printf("Division of two complex numbers = %d %di",temp1/temp3,temp2/temp3);
如果temp/temp3
评估为25并temp2/temp3
评估为15,则该行
printf("Division of two complex numbers = %d %di",temp1/temp3,temp2/temp3);
将打印
Division of two complex numbers = 25 15i
在i
上述格式说明打印的信i
。该%d
部分打印的数字。i
在上述格式说明符中使用的唯一目的是以一种更加用户友好的方式打印复数的实部和虚部。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句