#include<iostream.h> float getave(int n, float sc[]){ float ave=0; for(int i=0;i<n;i++){ ave=sc[i]+ave;} ave=ave/3.0f; return ave;}
void main(){如果要实现多 char name[12];个学生的成 float score[3];绩计算呢? cin>>name; for(int i=0;i<3;i++){ cin>>score[i];} cout<<name<<“的平均成绩是:”<<getave(3,score)<<endl;}
百度搜索“70edu”或“70教育网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,70教育网,提供经典教育范文第一章 面向对象概述(8)在线全文阅读。
相关推荐: