贵阳到洛阳航班时刻表:#include<format.h>

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 14:10:48
#define INTERGER(d) printf("%d\n",d)
#define FLOAT(f) printf("%8.2f\n,f)
#define STRING(s) printf("%s\n",s);
#include "format.h"
main()
{
int d,num;
float f;
char s[80];
printf ("Choice data format :1-integer,2-float,3-string:");
scanf("%d",&num);
switch(num)
{
case 1:printf("input integer:");
scanf("%d",&d);
INTEGER(d);
break;
case 2:printf("input float:");
scanf("%f",&f);
FLOAT(f);
break;
case 3:printf("input string:");
scanf("%s",&s);
STRING(s);
break;
default:printf("input error!");
}
}
大虾们,我不会用#include命令来包含文件,如以上程序该怎样让它运行

#define INTERGER(d) printf("%d\n",d)
#define FLOAT(f) printf("%.2f\n",f)
#define STRING(s) printf("%s\n",s);
#include "stdio.h"
main()
{
int d,num;
float f;
char s[80];
printf ("Choice data format :1-integer,2-float,3-string:");
scanf("%d",&num);
switch(num)
{
case 1:printf("input integer:");
scanf("%d",&d);
INTERGER(d);
break;
case 2:printf("input float:");
scanf("%f",&f);
FLOAT(f);
break;
case 3:printf("input string:");
scanf("%s",&s);
STRING(s);
break;
default:printf("input error!");
}
}
/*修改过后就可以运行了 你那个format.h不知道啥东西 只需添加标准输入输出就可以了 你程序本身有错 我帮你改下来了 你参照下*/