标签:
#include<stdio.h>
int main(void)
{
unsigned width,precision;
int number=256;
double weight=242.5;
printf("What 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);
}
其中修饰符*表示一个变量可以填补进去表示一个数字。
scanf则提供截然不同的服务
#include<stdio.h>
#define CNBLOG "I love CnBlog"
int main(void)
{
int n;
printf("Please enter three number\n");
scanf("%*d %*d %d",&n);
printf("The last integer was %d\n",n);
}
此时仍然需要读入3个数字 但是只有最后一个 放入n
标签:
原文地址:http://www.cnblogs.com/HJL085/p/5281857.html