题目
C++帮助,
#include
void getOption(int *option);
void getNumbers(int *option,float *number1,float *number2);
float calc(int *option,float *number1,float *number2);
void printResult(float number1,float number2,float result,int option);
main()
{
float outcome;
float number1,number2;
int option;
do
{ getOption (&option);
if (option = 5)
{
getNumbers(&option,&number1,&number2);
outcome=calc(&option,&number1,&number2);
printResult(number1,number2,outcome,option);
}
} while ( option!=5);
}
void getOption(int *option)
{
printf(": ");
scanf("%f",number1);
scanf("%f",number2);
if (*option==4 && *number2==0)
printf("除数不能为零! ");
} while(*option==4 && *number2==0);
}
float calc(int *option,float *number1,float *number2)
{
float result;
switch(*option)
{ case 1:result=*number1+ *number2; break;
case 2:result=*number1- *number2; break;
case 3:result=*number
#include
void getOption(int *option);
void getNumbers(int *option,float *number1,float *number2);
float calc(int *option,float *number1,float *number2);
void printResult(float number1,float number2,float result,int option);
main()
{
float outcome;
float number1,number2;
int option;
do
{ getOption (&option);
if (option = 5)
{
getNumbers(&option,&number1,&number2);
outcome=calc(&option,&number1,&number2);
printResult(number1,number2,outcome,option);
}
} while ( option!=5);
}
void getOption(int *option)
{
printf(": ");
scanf("%f",number1);
scanf("%f",number2);
if (*option==4 && *number2==0)
printf("除数不能为零! ");
} while(*option==4 && *number2==0);
}
float calc(int *option,float *number1,float *number2)
{
float result;
switch(*option)
{ case 1:result=*number1+ *number2; break;
case 2:result=*number1- *number2; break;
case 3:result=*number
提问时间:2021-03-03
答案
#include//:
");scanf("%f",number1); scanf("%f",number2);if (*option==4 && *number2==0) //意思为option为4(除号),并除数为0,不能计算printf("除数不能为零!
");} while(*option==4 && *number2==0); //直到...
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点
- 1化合价怎么写怎么读啊
- 2判定圆x^2+y^2-6x+4y+12=0与圆x^2+y^2-14x-12y+14=0是否相切?
- 3一项工程,甲单独做20天完成,乙单独做15天完成.(1)甲、乙工作时间的最简整数比是( ).拜托
- 4一切问题最终都是时间问题,一切烦恼其实都是自寻烦恼.这句话的意思是什么?
- 5“美,是道德上善的象征”什么意思?
- 6什么是土星光环?
- 7一张桌子的桌面是长方形,其长为6米,宽为4米,长方形台布面积是桌面面积的2倍,如果将台布铺在桌子上...
- 8把函数y=sin(2x+π/3)的图像按向量φ平移后所得的图像关于直线x=π/6对称,则向量φ的坐标可能为( ,)
- 9成语提问.
- 10人们为什么把π值作为数学家卢道尔的墓志铭?