
C++编程,有几道题目不会,大家帮帮忙啊
1.Writeaprogramthatrepeatedlyasksyoutoenterpairsofnumbersuntilatleastoneofthepairisze...
1. Write a program that repeatedly asks you to enter pairs of numbers until at least one of the pair is zero. For each pair, the program should use a function to calculate the Harmonic Mean(调和平均数)of the numbers ,and use another function to calculate the Arithmetic Mean(算术平均数)of the numbers. Two functions should return the answer to main(), which reports the result. The harmonic mean of the numbers can be calculated as follows:harmonic mean = 2.0 * x * y / (x + y)
写一个程序,一直让你输入两个数字(一组),直到其中一个数字为0,才不让你继续.对于每组数字,计算它们的调和平均数和算术平均数,然后输出.
调和平均数是这样的: 2.0 * x * y / (x + y) 展开
写一个程序,一直让你输入两个数字(一组),直到其中一个数字为0,才不让你继续.对于每组数字,计算它们的调和平均数和算术平均数,然后输出.
调和平均数是这样的: 2.0 * x * y / (x + y) 展开
2个回答
展开全部
整个程序最外面的大循环可以用while(1)弄成死循环,里面再if(0==i*j) break;就行了。至于别的,就用scanf和printf或者cin和cou语句管输入输出,计算公式你自己也列出来了,这个代码应该很简单啊,怎么没人回答啊??
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询