~cpp #include <stdio.h> #include <string.h> void input(int *number); void operation(int number, char roma_data[3][4]); void output(int number, char resultdata[20][4]); void main() { int number = 0; char roma_data[3][4] = {"Ⅹ", "Ⅰ", "Ⅴ"}; while(1) { input(&number); if(number == 99) break; if(number > 99 || number <= 0) { printf("다시 입력해 주세요...n"); }else { operation(number, roma_data); } } } void input(int *number) { printf("숫자를 입력(종료:99) :"); scanf("%d", number); } void operation(int number, char roma_data[3][4]) { int numberdata[5] = {0,}; char resultdata[20][4] = {0,}; int i = 0; numberdata[0] = number / 10; numberdata[1] = number % 10; while(numberdata[0] > 0) { strcpy(resultdata[i], roma_data[0]); ++i; --numberdata[0]; } if(numberdata[1] == 4 || numberdata[1] == 9) { strcpy(resultdata[i], roma_data[1]); ++i; if(numberdata[1] == 4) strcpy(resultdata[i], roma_data[2]); else strcpy(resultdata[i], roma_data[0]); ++i; numberdata[1] = 0; }else if(numberdata[1] >= 5) { strcpy(resultdata[i], roma_data[2]); numberdata[1] -= 5; ++i; } while(numberdata[1] >= 1) { strcpy(resultdata[i], roma_data[1]); ++i; --numberdata[1]; } output(number, resultdata); } void output(int number, char resultdata[20][4]) { int i = 0; printf("%d : ", number); while(i < 18) { printf("%s", resultdata[i]); ++i; } printf("n"); }