~cpp #include <stdio.h> void main() { int a[] = {10, 40, 70, 80, 90, 99}; int b[] = {20, 30, 40, 50, 60, 70, 85, 90, 95, 97, 99}; int c[20], i = 0; int turn_a = 0, turn_b = 0, turn_c = -1; //C배열에 넣기 while(a[turn_a] <= 99 && b[turn_b] <= 99) { ++turn_c; if(a[turn_a] < b[turn_b]){ c[turn_c] = a[turn_a]; ++turn_a; }else if(a[turn_a] == b[turn_b]){ c[turn_c] = a[turn_a]; ++turn_a; ++turn_b; }else{ c[turn_c] = b[turn_b]; ++turn_b; } } // 출력 printf("***************n"); printf("*MERGE PROGRAM*n"); printf("***************n"); printf("A = "); while(i < turn_a){ printf("%d ", a[i]); ++i; } i = 0; printf("nB = "); while(i < turn_b){ printf("%d ", b[i]); ++i; } i = 0; printf("nC = "); while(i <= turn_c){ printf("%d ", c[i]); ++i; } }