该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
# include "T.h"
void Jia(void)
{
char ch;
int t = 1;
double BeiJiaShu, JiaShu, He;
BeiJiaShu = JiaShu = He = 0;
printf("请输入被加数 : ");
scanf("%lf", &BeiJiaShu);
printf("请输入加数 : ");
scanf("%lf", &JiaShu);
t = 1;
while (t != 3)
{
printf("选择整数加法还是浮点数加法 \n"
"1. 整数加法 2. 浮点数加法 \n"
"3. 退出\n");
scanf("%d", &t);
while ( ( ch = getchar () ) != '\n')
continue;
if (t == 1)
printf("%d + %d = %d \n", (int)(BeiJiaShu), (int)(JiaShu), (int)(BeiJiaShu) + (int)(JiaShu) );
if (t == 2)
{int t = 0;
printf("选择取小数点后几位: ");
scanf("%d", &t);
printf("%.*f + %.*f = %.*f \n", t, BeiJiaShu, t, JiaShu, t, BeiJiaShu + JiaShu);
}
printf("\n");
printf("是否还要继续使用加法功能,使用按 1 退出按 3 \n");
scanf("%d", &t);
printf("\n");
if (t == 1)
{ printf("请输入被加数 : ");
scanf("%lf", &BeiJiaShu);
printf("请输入加数 : ");
scanf("%lf", &JiaShu);
}
}
return 0;
}