fprintf与fscanf

#include <stdio.h>

int main()
{
	//printf("Please input the value a:\n");  等于下一句
	fprintf(stdout, "Please input the value a:\n");
	int a;
	//scanf("%d",&a);  等于下一句
	fscanf(stdin,"%d",&a);
	if(a<0){
		fprintf(stderr, "The value must > 0\n");
		return 1;
	}else{
		fprintf(stdout, "The value a is %d\n",a);
	}

	return 0;
}

posted @ 2015-11-13 13:41  樱风凛  阅读(172)  评论(0编辑  收藏  举报