C++ 전광판 효과 내기





#include <Windows.h>

#include <iostream>

#include <string>



void SetPosition(short x, short y)

{

COORD position = { x, y };

SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), position);

}


void Print_Frame(size_t length)

{

SetPosition(0, 2); std::cout << "┌";

SetPosition(0, 3); std::cout << "│";

SetPosition(0, 4); std::cout << "└";


for (int i = 1; i < length+1; ++i) 

{

SetPosition(i, 2);

std::cout << "─"; 

SetPosition(i, 4);

std::cout << "─";

}


SetPosition(length+1, 2); std::cout << "┐";

SetPosition(length+1, 3); std::cout << "│";

SetPosition(length+1, 4); std::cout << "┘";

}


void Print_Numbers(std::string& Array)

{

std::string moving = Array;

Array.erase(Array.begin());

Array += moving[0];

std::cout << Array << "\n";

}


int main()

{

std::string inputArray;

std::string tempArray;


std::cout << "문자열을 입력해주세요 : ";

std::cin >> inputArray;


Print_Frame(inputArray.size());


while (!inputArray.empty())

{

SetPosition(1, 3);

Print_Numbers(inputArray);

Sleep(200);

}


std::cout << std::endl;

SetPosition(0, 6);

system("pause");

return 0;

}











0 comments:

댓글 쓰기