일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- #자바상속#자바이즈어#is~a
- #JAVASCRIPT
- #binary
- git flow
- #다차원포인터
- border-box
- docker example
- html id
- html youtube
- html multimedia
- #android activity
- #CallByAddress
- html code
- #성적관리프로그램
- html plug-in
- 토큰경제
- mac terminal command
- html object
- #2차원배열
- #bubbleSort
- html charset
- html5 new tag
- hyperledger transaction
- #1차원배열
- #C++ has~a
- #3차원배열
- #C++ 연산자함수오버로딩
- 하이퍼레저패브릭
- relative path
- html video
- Today
- Total
A sentimental robot
Call by address 본문
#include<stdio.h>
#pragma warning(disable : 4996);
void input(int *clas, char *pname, int *pscore);
void oper(int *pscore, float *pavg);
void output(int *clas, char*pname, int *pscore, float *pavg);
void main() {
int clas[3] = {0,};
char name[3][3][10];
int score[3][3][4] = {0,};
float avg[3][3] = {0,};
input(clas, **name, **score); // 1차원 주소로 맞추기
oper(**score, *avg);
output(clas, **name, **score, *avg);
}
void input(int *clas, char *pname, int *pscore) {
int i, j, k;
for (k = 0 ; k<3 ; k++) {
printf("Class number:");
scanf("%d", clas + k);
for (i = 0; i<3 ; i++) {
printf("Name input : ");
scanf("%s",(pname + k * 30) + (i * 10));
for (j = 0 ; j<3 ; j++) {
printf("Score input :");
scanf("%d", ((pscore + k * 12) + (i * 4)) + j);
}
}
}
}
void oper(int *pscore, float *pavg) {
int i, j, k;
for (k = 0; k<3; k++) {
for (i = 0; i<3; i++) {
for (j = 0; j<3; j++) {
*(((pscore + k * 12) + i * 4) + 3) += *(((pscore + k * 12) + i * 4) + j);
}
*((pavg + k * 3) + i ) = *(((pscore + k * 12) + i * 4) + 3) / 3.f;
}
}
}
void output(int *clas, char*pname, int *pscore, float *pavg) {
int i, j, k;
for (k = 0; k<3; k++) {
printf("%d\n", *(clas + k));
for (i = 0; i<3; i++) {
printf("%s\t",( pname + k * 30 )+ i * 10);
for (j = 0; j<4; j++) {
printf("%d\t", *(((pscore + k * 12) + i * 4) + j));
}
printf("%f\n", *(pavg + k * 3) + i);
}
}
}