Toggle navigation
Courses
Questions
Tags
Users
AC 20161221 exercise 1
0
like
0
dislike
1.8k
views
有一個學生的結構如下
struct Student {
int grade[20];
int count;
};
grade 陣列裡儲存的是每位學生的成績, count 裡儲存的是該位學生共修習多少科目,請用這個結構實作以下函數。
int average_grade(struct Student s);
該函數傳入一個學生的結構,然後計算出該學生的平均後回傳。
[Exercise]
Essay (Open question)
-
asked
Dec 21, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 19748 -
Available when:
Unlimited
-
Due to:
Unlimited
edited
Dec 21, 2016
by
Shun-Po
|
1.8k
views
comment
Please
log in
or
register
to add a comment.
20
Answers
0
like
0
dislike
Hidden content!
int *** ** **** Student s)
{
** * * * **** ***** ** i; ** * * * *** * **** counter
* ****** * * * avg; ** * * record the average
** * * * **** * * ** * * * *** i++)
***** ** *** ***
* * ** ** * * * * *** * * * * * * * ** * compute total score
*** * *** *** ** *** * ******* ** * * * ** * * += * *
** ** * * ** *** *** *
** ****** * * * * /= s.count; *** * ******** * get average score
** ** * ** ** *** * * * (int)avg; * * ** * ** change data type and return
}
answered
Jan 8, 2017
by
羅祖嘉
(
-248
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include *** **
#include * * ****
#include * * ** * ****
* ** * * ** *****
struct Student {
*
** ***** * * * *
* ***
*** ** **** count;
* ** *
};
int ** ** Student s)
{
***
* ** * * * ** *** * i; ******** * *
** **
* ***** * * * **** average = 0,sum = 0;
* *
*** ** ** **** * * * **** (i = 0;i < * ***
****** *
** ** * * * ********** *
* ** *
** ** ** * ** *** * **** ** ** * ** += ***** * * * * *
* *
*** * * ** ** *** * **
**
*** ** ** * ** * ***** * * = sum / * * *
*** *
* * ******* * ** **** * *** ****** ***** ** ***
* * *
}
* ******
int *** ***
*** *
{
***
****** ** ***** * * ** ** i=0;
*
** *** **** *** * ******** Student s;
* **
** * * *** *** * ** ** *** ** * **** ****** *
* ***
* * * ** ***** * *** * * * (i = 0;i < *
** *** *
*** * *** * ** * * * * * *** ***** *** * *** ** *** * ** * ****
** *
}
* * **
**** *
***** * * * ** * ** 0;
**** **
}
answered
Jan 5, 2017
by
松山金城武
(
102
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
int * * ***** *** a){
* ** *** * * ** * * * = 0, total = 0;
* ** **** * * ** i = 0;
* * * *** * ****** = 0;i ** * ** ++)
* ** * * ** * * * * ** * = total + *** *
* * **** * * * * * = total / ** * *
** * * * * **** * * * *** ** * ***
}
answered
Jan 5, 2017
by
Doloa
(
-122
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);
int main(void)
{
********* * * *** i;
** * * *** *** * * * student s;
*** * ** * * * **** ** * *** ** *** ** *
*** * ** ** ** ** * * * **** * ****
** ** * ***** *** * * * * * ** ***** * * * *** * * ** * * ** *
* * ** ** ********* * * * *** ** *** * * *** * * * * *
* * **** *** * ** * 0;
}
int * * * * * student s)
{
** * * * * * * * ** * * * *
** ** * * * ** ** *** * ** ** *
*** * *** * ** * = sum + ** **
* ** * * ** * * * = *** * *
* * ** ***** *** ** * * * average;
}
answered
Jan 5, 2017
by
林宗鴻
(
-72
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=0,j=0,k=0,r=0;
*** * **** *** ** *** ** ** **
**** ** ****** * * * * * ***
* * ** * * ** ** *** *
* * **** ** *** ** ******
*** * * ***** * * r;
* * ** ** * *** * * * *
}
answered
Dec 30, 2016
by
蘇瑋朝
(
-8
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) {
** ** ***** * * * * * i=0, j=0, a;
**** ** **** ** * * ** (i = 0; i < **** * * i++)
***** * *** * * * * * * * * * *** * **** * += ** ** * *
* * * * *** * **** = j / * ****** *
* ** **** ** * * a;
}
int main() {
* ** *** * ** ** **** * * * Student t = {
** * * ** **** ** * *** **** * * * 100, 23, 33 }, 3
****** * *** ** * ** ***
** * *** **** ** * * ** * *** * ** *** * *** * *
* * * * * **** * **** * * 0;
}
answered
Dec 28, 2016
by
410342026
(
-105
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
struct Student {
* ** * * * grade[20];
* ** * * **** ** count;
};
int average_grade(struct Student s)
{
* * * * ** * * *** **** * i;
* * * * * * ***
* * *** * ** ** * * *** ** * average = 0,sum = 0;
* ** ** ** *** * * * ** (i = 0;i < s.count;i++)
* * * *** * **** * ** *** *
* * * * **** ****** * *** * **** * *
* * * * ** ** ** ** * ***** ** * * ** += (s.grade[i]);
* * * * ** * *** ** * ** ** * * ** ******
// * ** * ** * * * **** * * **** **** ** * ** * * ",sum);
** *** * ***** * * * * ** **** * ** * * * *
** ** * ** ***
** **** ***** * * ** **
* *** ** * ** *** *** = sum / (s.count);
** * ** ** ** ** * * *
**** ***** * **** * * * * ** **
}
int main(void)
{
* * * * * ***** **
** ** ******** * ****** * i=0;
*** * ** *** * * *
* * ***** ** ** **** * Student s;
**** * *** * ** * **
* ** * * * ** ** ** * * * * ** * * * * * * * *
** * **** *** * ** *
// * * **** * ** *** ****** * * *
** **** * * ***** * *
* * *** * *** * * **** * * (i = 0;i < s.count;i++){
** * * * **** * * * *
***** ** * ** ******* * * * * ** * * * * * * *
* ** ***** ** * *
// ** * ** * ******** ** * * *** ** * *
* *** * * * **
}
**** * ** * * *** ** * *
** ** * * *** *** * ***
* **** *** *** ** * ** ** 0;
*** * **** * * * * *
}
answered
Dec 24, 2016
by
410523007
(
-157
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);
int main(void)
{
** *** * ** ** ** ** i;
* **** ** *** * *** ***** student s;
** *** **** *** ** * * *** * *** ** *** * * **** *
*** * ** *** ** *** * **** * *******
* **** * * ** *** ** **** * * **** ** * ** **** * * * **** **
* * **** **** ***** * * *** ** ** ** * ****
** * *** * ****** * * 0;
}
int * * ** * * student s)
{
* * * * * * **** ** * * * ** * **
* * ** *** * * * * * ** * * * * *
*** ** ***** ***** * * * * ** = sum + s.grade[j];
* * **** **** * ** ** ** = sum/s.count;
*** * * ** ** ** * ** average;
}
answered
Dec 22, 2016
by
Jim870729
(
-102
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);
int main(void)
{
int i;
* ** * *** *** ***** Student s;
* * ***** ** * ** * * ***** *
*** * *** * * * * *** ** * *
* *** * * * * * * * * * * * * * ** * ********* **
** ** ** * *** *
*** * *** * *** ** ** *** * **** ***
** * * * **** *** ** ** * * 0;
}
int ** * *** * * Student s)
{
* * * * * * *** * * k,b=0;
******** *** *** * ** * ** * **
* * ** *** * * **** * * = b+s.grade[k];
*** * ** ** *** * * = b/s.count;
* * * *** *** * ** * ** * * **** **
}
answered
Dec 22, 2016
by
410523016
(
-136
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include <stdio.h>
#include * * ***
struct student
{
* ** *** * **** * grade[20];
** *** **** * ** * * count;
}s;
int main(void)
{
****** ** *** *** * ** * * * student s;
* * ***** ** ** **** grade[20];
* ** * * *** *** count;
* * * * ** *** ** ** i;
***** * * * * **** sum = 0;
* * * ** *** * * *** * **** ** aver = 0;
** *** * ** * * ** ** * **** ********* * **
** **** ** ** * * * * = 1;i <= count;i++)
* *** **** * * * *
* ** * * *** ** ** * * **** * * * ** * * *** ** *** *** ** ****** *
* ** * * * * * ** * ** ** ** * ** ** ** * += grade[i] ;
*** * * *** **
** *** * * ** * ** * ** ** * = sum / count;
*** ** * ** ** * * * **** ** ** ***
* ** ****** * ** **** ** ** * 0;
}
answered
Dec 21, 2016
by
Ren
(
-320
points)
ask related question
comment
Please
log in
or
register
to add a comment.
Page:
1
2
next »
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English
中文
Tiếng Việt
IP:172.69.58.113
©2016-2025
Related questions
0
like
0
dislike
3
answers
AC 20161221 exercise 3
[Exercise]
Essay (Open question)
-
asked
Dec 21, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 19755 -
Available when:
Unlimited
-
Due to:
Unlimited
|
554
views
0
like
0
dislike
9
answers
AC 20161221 exercise 2
[Exercise]
Essay (Open question)
-
asked
Dec 21, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 19753 -
Available when:
Unlimited
-
Due to:
Unlimited
|
1.1k
views
0
like
0
dislike
0
answers
AC 20161228 exercise 1
[Exercise]
Essay (Open question)
-
asked
Dec 28, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 20139 -
Available when:
Unlimited
-
Due to:
Unlimited
|
379
views
0
like
0
dislike
82
answers
AC 20161123 exercise 1
[Exercise]
Coding (C)
-
asked
Nov 23, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 17578 -
Available when:
Unlimited
-
Due to:
Unlimited
|
5.2k
views
0
like
0
dislike
26
answers
AC 20161109 exercise 1
[Exercise]
Essay (Open question)
-
asked
Nov 9, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 17203 -
Available when:
Unlimited
-
Due to:
Unlimited
|
2.3k
views
12,783
questions
183,442
answers
172,219
comments
4,824
users