C语言使用变宽输出字段 C语言scanf函数实例 C语言跳过输入字符实例 C语言使用变宽输出字段 /* varwid.c -- uses variable-width output field */ #include <stdio.h> int main(void) { unsigned width, precision; int number = 256; double weight = 242.5; printf("Enter a field width:\n"); scanf("%d", &width); printf("The number is :%*d:\n", width, number); printf("Now enter a width and a precision:\n"); scanf("%d %d", &width, &precision); printf("Weight = %*.*f\n", width, precision, weight); printf("Done!\n"); return 0; } C语言scanf函数实例 C语言跳过输入字符实例