Toggle navigation
Courses
Questions
Tags
Users
AD 20161222 exercise 1
0
like
0
dislike
3k
views
有一個學生的結構如下
struct Student {
int grade[20];
int count;
};
grade 陣列裡儲存的是每位學生的成績, count 裡儲存的是該位學生共修習多少科目,請用這個結構實作以下函數。
int average_grade(struct Student s);
該函數傳入一個學生的結構,然後計算出該學生的平均後回傳。
[Exercise]
Essay (Open question)
-
asked
Dec 22, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 19793 -
Available when:
Unlimited
-
Due to:
Unlimited
|
3k
views
comment
Please
log in
or
register
to add a comment.
23
Answers
0
like
0
dislike
Hidden content!int ***** * * * Student s)
{
* * * * * ** *** * i , sum = 0 ;
** * * * * * * * * * * * ** * * *** ** * **
* * * **** * * *** * ** ** ***** * * * ** * ** += s.grade[i];
* ** * * * * * * * * * * * * *** ;
}
answered
Jan 4, 2017
by
Phoenix666
(
-162
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!#include ***** * * * * *
#include * ** ** * *
#include * * * *** * *
#include * * * * ******** *
struct Student {
** * * ** * * * * *
*** *** * ** ** *** * * count;
};
* * * ***
int * ** * *** Student s)
{
* * * * ** *** ** *** * * * i; ** * *
* * **** * ** * ** * * * * average = 0,sum = 0;
***** * * ** * * * * * **** (i = 0;i < * ** * *
** * * * * * ** * * *
* ** * * * ** *** ** * * **** * * * * * * ** **** *** += ** * * * * * *