| 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 | #define _CRT_SECURE_NO_WARNINGS #include <windows.h> #include <stdio.h> #include <conio.h> #define SIZE 10 int main(void) { int list[SIZE] = { 100, 30, 20, 78, 89, 12, 56, 38, 99, 66 }; for (int k = 0; k < SIZE; k++) { system("cls"); // 화면을 지운다. for (int i = 0; i < SIZE - 1; i++) { // 버블 정렬 if (list[i] > list[i + 1]) { int tmp = list[i]; list[i] = list[i + 1]; list[i + 1] = tmp; } } for (int i = 0; i < SIZE; i++) { for (int m = 0; m < list[i] / 10; m++) // 세로로 막대를 그린다. printf("*"); printf("\n"); } _getch(); // 사용자로부터 하나의 문자를 받을 때까지 기다린다. } return 0; } | cs |


https://itsys.hansung.ac.kr/cgi-bin/onlineTest/viewCcoding/onlineCcoding.cgi?source=src/chap07/draw_bubble.c
C프로그래밍(프로그래밍언어) 실습게시판