Toggle navigation
Courses
Questions
Tags
Users
AD 20161222 exercise 1
0
like
0
dislike
1.7k
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
|
1.7k
views
comment
Please
log in
or
register
to add a comment.
23
Answers
0
like
0
dislike
Hidden content!
int ** *** *** * *** Student s){
* * * * * * *** ***
***
* ** * * * ** ** * *** ***
** * * * * * * * ** *
* * * ** * * total / s.count;
}
answered
Dec 22, 2016
by
goodboy110222
(
-186
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
int * * *** * * student s)
{
int sum=0,i,ave;
* * ** * * ***
* *** ** * *** * ** * *
* * * * ** * ** * ****** ** ** **
** * **** ******* ** * ave;
}
answered
Dec 22, 2016
by
chen
(
-102
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
int average_grade(struct Student s)
{
**** * **** ** ** ** i;
* ** ******* * * sum=0;
***** * * * * ** ** *** **
**** * * ** **** * * ** * * *
* * ** ** *** * ***** *** *** **** **** ** ** ** = sum + s.grade[i];
* * *** ** * ** ** * * *** * ** **
** * * * * ****** *
* *** * ** * * * *** * ** sum;
}
answered
Dec 22, 2016
by
410523043
(
156
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include * * ********* * *
#include ** **** ***** **
struct Student {
* *** ** * grade[20];
* **** * * * count;
};
float average_grade(struct Student s);
int main(void) {
** **** * * ******* Student s;
**** * ****** * * *
* *** ** ** *** * * * **
* * * * * ** * * * *
** * ** *** * ** * * **
* * ** ** * * * * ** ** *
*** * *** ** ** * * * * * * ** * is ** * ** ** *****
* * *** * *** **** * EXIT_SUCCESS;
}
float average_grade(struct Student s){
* ** *** * * ** *** i=0,sum=0;
* * * ** ** * * ** * ** a;
* ** * *** ** ****** ** ** * ** ** **
** * ****** ** * * * ** * ** * **** * ** ****** * * ******
** ** * *** ** *** ** ** **
* ** **** **** * * ** * *
* * * ** ** ** * * * a;
}
answered
Dec 22, 2016
by
410421238
(
-38
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
struct student {
** *** * ** grade[20];
* **** * * * ** * * *** count;
};
int * ***** student s) {
* * ** *** * ****** * ** avg =0,
** * * * * ***** * * ** * * * *** ** * ** =0,
****** *** * **** * *** * * ***** * * * *
*** * ** ** * * * *
*** * ** ** * * * = 0; j < s.count; j++){
** ** *** * ** * ** *** **** ** ********* * = sum + s.grade[j];
***** * * ****** *
* * ** ** **** * * *
** **** * ** * * *** = sum / s.count;
** * * *** ** ** * *
* * * *** * * * avg;
}
answered
Dec 22, 2016
by
410423016
(
-170
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
int * * ** * Student s)
{
* **** * ** ***** * **** * i, sum = 0, avg = 0;
** ** ** * ** * * * *** *** = 0; i ***** ** i++)
* * * ** ** * *
** **** * *** ** * * *** * * * ** * *** = sum + * * * **
** * ***** ** ** **
* ***** * * * = sum / s.count;
*** **** *** ***** * * avg;
}
answered
Dec 22, 2016
by
kyle wen
(
-202
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
int * * ** * ** Student s)
{
* *** * *** *** * **** sum = 0,avg = 0, i;
** *** *** * ** * ** * ** (i = 0; i < ** i++)
* * *** **** * ** * *** *
**** ******* **** * ** ** *** *** ** **** = sum + **
**** * * * **** *** ** * *
** ** ** ** ** ** * *** = sum / *
*** ** **** * * * *** * avg;
}
answered
Dec 22, 2016
by
410314217
(
-214
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
* * * * * * * { * * ** ** * ** * * ** = * * ** }
answered
Dec 22, 2016
by
楊傑宇
(
-202
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
int average_grade(struct Student s)
{
**** ** * **** ***** Student s;
* ** ** * i;
* ***** ** sum=0;
* ****** * * *** * * *****
* ******* ** ***** * *** * ***
* *** ** ****** *** ** *** * **** *** ** * **** * * **** = sum + c.grade[i];
** ***** ****** ***** **** **** **** *
**** * * * ** * ***
** * * *** * * **** sum;
}
answered
Dec 22, 2016
by
410523043
(
156
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
int average_grade(struct Student a,struct Student b)
{
** ** ** * * * ** Student c;
*** ** **** * ***** * i;
* * **** * ** * **** * sum=0;
** * * * ***** * * ****
** * **** * ** * **** * **** *****
** * ** ** **** * * * ** ** * * * ** ** **** ** * = sum + c.grade[i];
* * * **** * * ** *** * * *
* ** * **** *** * **
** * ** * **** sum;
}
answered
Dec 22, 2016
by
410523043
(
156
points)
ask related question
comment
Please
log in
or
register
to add a comment.
Page:
« prev
1
2
3
next »
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English
中文
Tiếng Việt
IP:108.162.216.4
©2016-2025
Related questions
0
like
0
dislike
7
answers
AD 20161222 exercise 2
[Exercise]
Essay (Open question)
-
asked
Dec 22, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 19794 -
Available when:
Unlimited
-
Due to:
Unlimited
|
834
views
0
like
0
dislike
65
answers
AD 20161124 exercise 1
[Exercise]
Coding (C)
-
asked
Nov 24, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 17667 -
Available when:
Unlimited
-
Due to:
Unlimited
|
3.8k
views
0
like
0
dislike
20
answers
AD 20161110 exercise 1
[Exercise]
Essay (Open question)
-
asked
Nov 10, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 17220 -
Available when:
Unlimited
-
Due to:
Unlimited
|
1.6k
views
0
like
0
dislike
26
answers
AD 20161103 作業1
[Exercise]
Coding (C)
-
asked
Nov 3, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 16957 -
Available when:
Unlimited
-
Due to:
Unlimited
|
2k
views
0
like
0
dislike
37
answers
AD 20161020 作業 1
[Exercise]
Coding (C)
-
asked
Oct 20, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 14579 -
Available when:
Unlimited
-
Due to:
Unlimited
|
2.5k
views
12,783
questions
183,442
answers
172,219
comments
4,824
users