Definition of a function- C programming?

2016-10-10 3:48 pm
Write the definition of a function named averager that receives a double parameter and return-- as a double -- the average value that it has been passed so far. So, if you make these calls to average, averager(5.0), averager(15.0), averager(4,3), the values returned will be (respectively): 5.0, 10.0, 8.1

回答 (2)

2016-10-10 4:38 pm
✔ 最佳答案
double averager(double a){
static double s=0.0;
static c;
s+=a;
c++;
return s/c;
}
2016-12-25 10:43 am
1
參考: Psoriasis Relief http://enle.info/HealPsoriasisNaturally


收錄日期: 2021-05-01 21:12:53
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20161010074801AAuqBCf

檢視 Wayback Machine 備份