목차
■ 이해점검 풀이
■ 프로그램 문제 풀이
■ 프로그램 문제 풀이
본문내용
15
125
28
56
34
32
69
57
56
59
45
33
45
#include
#define rows 4 // 행의 합과차를 정하는 상수
#define cols 3 // 열의 합과차를 정하는 상수
void print(int [][3]); //결과값을 출력하는 함수
int main(void)
{
int i,j;
int s1[4][3], s2[4][3];
int x[][3]={{35,28,73},
{25,32,73},
{97,56,23},
{45,97,15}};
int y[][3]={{125,28,56},
{34,32,69},
{57,56,59},
{45,33,45}};
printf("다음 두 행렬의 합과 차를 구하는 프로그램입니다.\n");
printf(" \n"
"| 35 | 28 | 73 | | 125| 28 | 56 |\n"
"| 25 | 32 | 69 | | 34 | 32 | 69 |\n"
"| 97 | 56 | 23 | | 57 | 56 | 59 |\n"
"| 45 | 97 | 15 | | 45 | 33 | 45 |\n"
" \n");
for(i=0; i
for(j=0; j
s1[i][j] = x[i][j] + y[i][j];
printf("\n위의 두 행렬 합의 결과 값입니다.\n");
print(s1);
for(i=0;i
for(j=0;j
s2[i][j] = x[i][j] y[i][j];
printf("\n위의 두 행렬 차의 결과 값입니다.\n");
print(s2);
return 0;
}
void print(int x[][3])
{
int i, j;
printf("\n");
for(i=0; i
for(j=0; j
printf("|%4d", x[i][j]);
printf("|\n");
}
printf("\n");
}
본인이 이번 학기에 수강하는 과목의 학점 수와 성적을 입력 받아 이번 학기의 평균평점을 출력하는 프로그램을 작성하시오. (가능한 한 많은 배열을 이용하고, 성적의 평점은 여러분 학교의 평점으로 하며, 출력 결과는 다음과 같이 하시오)
#include
void print(int totalcredit, double totalpoint);
#define NUMOFLECTURE 8
char *lecture[NUMOFLECTURE][2] = { {"교선", "21세기 트랜드와 경영"},
{"교선", "영어 듣기"},
{"교선", "현대 사회와 인간"},
{"전선", "윈도우 프로그래밍"},
{"전선", "전자상거래 응용사례"},
{"전필", "데이터베이스"},
{"전필", "시스템분석설계"},
{"전필", "웹 프로그래밍"} };
char *GRADE[] = {"F", "D0", "D+", "C0", "C+", "B0", "B+", "A0", "A+"};
double GRADEPOINT[] = {0.0, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5};
int point[NUMOFLECTURE][2];
int grade[NUMOFLECTURE];
int main(void)
{
double totalpoint = 0.0;
int totalcredit = 0;
int i=0;
printf("다음 표시되는 강좌의 학점과 점수를 입력하세요.\n");
printf("A+ : 95 ~ 100, A0 : 90 ~ 94, ");
printf("B+ : 85 ~ 89, B0 : 80 ~ 84\n");
printf("C+ : 75 ~ 79, C0 : 70 ~ 74, ");
printf("D+ : 65 ~ 69, D0 : 60 ~ 64, F : 59 이하 \n\n");
printf("입력 예 >>\n");
printf("%6s%30s", lecture[0][0], lecture[0][1]);
printf(" >> 2(학점) 96(점수)\n\n");
printf("지금부터 입력하세요. >>\n");
for (i=0; i
printf("%6s%30s >> ", lecture[i][0], lecture[i][1]);
scanf("%d %d", &point[i][0], &point[i][1]);
grade[i] = point[i][1] / 5;
totalpoint += point[i][0] * GRADEPOINT[grade[i]11];
totalcredit += point[i][0];
//printf("%lf\n", GRADEPOINT[grade[i]11]);
}
print(totalcredit, totalpoint);
return 0;
}
void print(int totalcredit, double totalpoint)
{
int i;
printf("\n**************************************************************\n");
printf("%7s%18s%17s%18s\n", "구분","과 목 명","학 점","성 적");
printf("\n");
for (i=0; i
printf("%7s%23s%12d%16s\n", lecture[i][0], lecture[i][1],
point[i][0], GRADE[grade[i]11]);
printf("\n");
}
printf("%7s%18s%17s%18s\n","학점계","평 점 계","평점평균","백분율환산");
printf("**************************************************************\n");
printf("%7d%17.1f%14.2f/4.5%17.1f\n", totalcredit, totalpoint,
(totalpoint / totalcredit), 100 * (totalpoint / totalcredit) / 4.5 );
printf("**************************************************************\n");
}
125
28
56
34
32
69
57
56
59
45
33
45
#include
#define rows 4 // 행의 합과차를 정하는 상수
#define cols 3 // 열의 합과차를 정하는 상수
void print(int [][3]); //결과값을 출력하는 함수
int main(void)
{
int i,j;
int s1[4][3], s2[4][3];
int x[][3]={{35,28,73},
{25,32,73},
{97,56,23},
{45,97,15}};
int y[][3]={{125,28,56},
{34,32,69},
{57,56,59},
{45,33,45}};
printf("다음 두 행렬의 합과 차를 구하는 프로그램입니다.\n");
printf(" \n"
"| 35 | 28 | 73 | | 125| 28 | 56 |\n"
"| 25 | 32 | 69 | | 34 | 32 | 69 |\n"
"| 97 | 56 | 23 | | 57 | 56 | 59 |\n"
"| 45 | 97 | 15 | | 45 | 33 | 45 |\n"
" \n");
for(i=0; i
printf("\n위의 두 행렬 합의 결과 값입니다.\n");
print(s1);
for(i=0;i
printf("\n위의 두 행렬 차의 결과 값입니다.\n");
print(s2);
return 0;
}
void print(int x[][3])
{
int i, j;
printf("\n");
for(i=0; i
printf("|\n");
}
printf("\n");
}
본인이 이번 학기에 수강하는 과목의 학점 수와 성적을 입력 받아 이번 학기의 평균평점을 출력하는 프로그램을 작성하시오. (가능한 한 많은 배열을 이용하고, 성적의 평점은 여러분 학교의 평점으로 하며, 출력 결과는 다음과 같이 하시오)
#include
void print(int totalcredit, double totalpoint);
#define NUMOFLECTURE 8
char *lecture[NUMOFLECTURE][2] = { {"교선", "21세기 트랜드와 경영"},
{"교선", "영어 듣기"},
{"교선", "현대 사회와 인간"},
{"전선", "윈도우 프로그래밍"},
{"전선", "전자상거래 응용사례"},
{"전필", "데이터베이스"},
{"전필", "시스템분석설계"},
{"전필", "웹 프로그래밍"} };
char *GRADE[] = {"F", "D0", "D+", "C0", "C+", "B0", "B+", "A0", "A+"};
double GRADEPOINT[] = {0.0, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5};
int point[NUMOFLECTURE][2];
int grade[NUMOFLECTURE];
int main(void)
{
double totalpoint = 0.0;
int totalcredit = 0;
int i=0;
printf("다음 표시되는 강좌의 학점과 점수를 입력하세요.\n");
printf("A+ : 95 ~ 100, A0 : 90 ~ 94, ");
printf("B+ : 85 ~ 89, B0 : 80 ~ 84\n");
printf("C+ : 75 ~ 79, C0 : 70 ~ 74, ");
printf("D+ : 65 ~ 69, D0 : 60 ~ 64, F : 59 이하 \n\n");
printf("입력 예 >>\n");
printf("%6s%30s", lecture[0][0], lecture[0][1]);
printf(" >> 2(학점) 96(점수)\n\n");
printf("지금부터 입력하세요. >>\n");
for (i=0; i
scanf("%d %d", &point[i][0], &point[i][1]);
grade[i] = point[i][1] / 5;
totalpoint += point[i][0] * GRADEPOINT[grade[i]11];
totalcredit += point[i][0];
//printf("%lf\n", GRADEPOINT[grade[i]11]);
}
print(totalcredit, totalpoint);
return 0;
}
void print(int totalcredit, double totalpoint)
{
int i;
printf("\n**************************************************************\n");
printf("%7s%18s%17s%18s\n", "구분","과 목 명","학 점","성 적");
printf("\n");
for (i=0; i
point[i][0], GRADE[grade[i]11]);
printf("\n");
}
printf("%7s%18s%17s%18s\n","학점계","평 점 계","평점평균","백분율환산");
printf("**************************************************************\n");
printf("%7d%17.1f%14.2f/4.5%17.1f\n", totalcredit, totalpoint,
(totalpoint / totalcredit), 100 * (totalpoint / totalcredit) / 4.5 );
printf("**************************************************************\n");
}
키워드
추천자료
- [전산] 프로그래밍 수치제어 포트란 소스
- 알기 쉽게 해설한 C
- Runge Kutta Method를 이용한 비행동역학 풀이 및 프로그래밍
- MATLAB의 기초, 소개
- 재귀함수(!팩토리얼),(피보나츠),(순환 함수)등 3가지 기초적인 레포트가 들어있다.
- 테트리스 프로그래밍 소스분석 레포트
- ATmega128과 Code vision C-compiler를 이용한 자동문 구현
- 04 C# 변수, 배열
- 명함관리 프로그램 발표(c언어)
- 단계별 실습으로 배우는 visual c++ 6.0 연습문제 풀이
- [고등학교교육][고등학생]고등학교 음주예방지도(음주예방교육), 고등학교 진로지도(진로교육...
- AVR ATmega 128 기본 프로그래밍 [마컴 예비레포트]
- 객체지향프로그래밍, c++
- 쉽게 풀어쓴 C언어 Express 12장,13장 연습문제
소개글