๋ชฉ๋ก๐ฉ๐ป IoT (Embedded)/C++ (38)
๐ ๊ณต๋ถํ๋ ์ง์ง์ํ์นด๋ ์ฒ์์ด์ง?
๐ wsl ์ด ๋๋ง๋ค.. ์๊ทน๋๋ ๋ฌธ๊ตฌ LifeGoal! ๋์ฐ๊ธฐ // shell์ export PICO ๋ฑ๋ก์ํค๊ธฐ!! // ์ค์ ํ์ผ ๋งจ ๋ฐ์... ํ๋ก๊ทธ๋จ ๋ฃ์ผ๋ฉด ๋จ vim .bashrc // .bashrc ์ ์ถ๊ฐํ ๊ฒ export PICO_SDK_PATH=~/pico/pico-sdk cd (๋ด ํ ๋๋ ํฐ๋ฆฌ, or main.out ํ์ผ ์์น) ./main.out // ๋์ LifeGoal ์ wsl ์คํ๋ง๋ค ์๊ธฐ ์ํค๊ธฐ // shell์ export PICO ๋ฑ๋ก์ํค๊ธฐ!! // export PICO_SDK_PATH=~/pico/pico-sdk // vim .bashrc // ์ค์ ํ์ผ ๋งจ ๋ฐ์... ํ๋ก๊ทธ๋จ ๋ฃ์ผ๋ฉด ๋จ // cd (๋ด ํ ๋๋ ํฐ๋ฆฌ) // ./main.out #include #inclu..
๋ฌธ๋ ๊ตฌ์กฐ์ฒด ์์ ์๋ ๋ฉค๋ฒ๋ณ์, ๋ฉค๋ฒํจ์์ ์ด๋ฆ์ ์ถ๋ ฅํ ์๋ ์์๊น? ์๊ฐ์ด ๋ค์๋ค ๊ทธ๋ฐ๋ฐ C# ์ด๋ฐ๋ฐ๋ reflection ์ด ์ฃผ์ด์ง๋ค๊ณ ํ๋ค C++ ์๋ boost ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก ์ ๊ทผ์ด ๊ฐ๋ฅํ๋ค๊ณ ํ๋๋ฐ ... ๊ณผ์ฐ? โญ boost ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ค์ดํ๊ธฐ https://www.boost.org/users/history/version_1_84_0.html Version 1.84.0 Version 1.84.0 December 13th, 2023 23:54 GMT Documentation DownloadsPlatformFileSHA256 Hash unixboost_1_84_0.tar.bz2cc4b893acf645c9d4b698e9a0f08ca8846aa5d6c68275c14c3e7949c24109454boo..
๋ฌธ์ ๋ ์๋ ์ฌ์ง์ ์ฐธ๊ณ ํ์ธ์ 1) for ๋ฌธ์ผ๋ก ์ผ์นํ๋ string ์ฐพ๊ธฐ 2) find ์ iterator ๋ก ๋๋ธ ์ฒดํฌํ๊ธฐ 3) find_if ์ ๋๋ค ํจ์๋ก ์ฒดํฌํ๊ธฐ โญ for ๋ฌธ์ผ๋ก ์ผ์นํ๋ string ์ฐพ๊ธฐ #include #include #include #include #include using namespace std; // ๋๋ผ ์ด๋ฆ๊ณผ ์๋ ๋ฌธ์์ด๋ก ๊ตฌ์ฑ๋จ class Nation { public: string nation; string capital; Nation() {} Nation(string nation, string capital) { this->nation = nation; this->capital = capital; } }; int main() { vector v; v.push..
=> C++ Let's Make Games ๐ซง ๊ตฌ์กฐ์ฒด๋ฅผ ์ด์ฉํ ํ์๊ด๋ฆฌํ๋ก๊ทธ๋จ 2 #include using namespace std; #define NAME_SIZE64 #define STUDENT_MAX10 #define ADDRESS_SIZE238 #define PHONE_SIZE14 struct _tagStudent { charstrName[NAME_SIZE]; charstrAddress[ADDRESS_SIZE]; charstrPhoneNumber[PHONE_SIZE]; intiNumber; intiKor; intiEng; intiMath; intiTotal; floatfAvg; }; enum MENU { MENU_NEXT, MENU_INSERT, MENU_DELETE, MENU_SEARCH, M..
=> C++ Let's Make Games ๐ซง ๊ตฌ์กฐ์ฒด๋ฅผ ์ด์ฉํ ํ์๊ด๋ฆฌํ๋ก๊ทธ๋จ 1 ๋ฒํผ : ์์์ ์ฅ๊ณต๊ฐ : cin ๋ด๋ถ์ ์ ๋ ฅ๋ฒํผ๊ฐ ์๋๋ฐ ์ ๋ ฅ๋ฒํผ๋ ์ ๋ ฅํ ๊ฐ์ ์ ์ฅํ๊ณ : ๊ทธ ๊ฐ์ ๋ณ์์ ๋ฃ์ด์ฃผ๋ ์ญํ : ์๋ฌ ์ฒดํฌํ๊ณ , cin.fail() ํ์ ๋ ์ ๋ ฅ ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉด true ๋ฐํ #include using namespace std; #define NAME_SIZE64 #define STUDENT_MAX10 #define ADDRESS_SIZE238 #define PHONE_SIZE14 struct _tagStudent { charstrName[NAME_SIZE]; charstrAddress[ADDRESS_SIZE]; charstrPhoneNumber[PHONE_SIZE]; intiNumber; ..
=> C++ Let's Make Games ๐ซง ๊ตฌ์กฐ์ฒด์ ๋ฌธ์์ดํจ์ ๊ตฌ์กฐ์ฒด : ๊ด๋ จ์๋ ๋ณ์๋ค์ ๋ชจ์์ ํ๋์ ์๋ก์ด ํ์ ์ ๋ง๋ค์ด์ฃผ๋ ๊ธฐ๋ฅ, ์ฌ์ฉ์ ์ ์ ๋ณ์ ํ์ struct ๊ตฌ์กฐ์ฒด๋ช {}; ๋ฐฐ์ด๊ณผ ๊ตฌ์กฐ์ฒด์ ๊ณตํต์ 1. ๋ฐ์ดํฐ ์งํฉ 2. ์ฐ์๋ ๋ฉ๋ชจ๋ฆฌ ๋ธ๋ญ์ ํ ๋น๋จ, ๊ตฌ์กฐ์ฒด ๋ฉค๋ฒ๋ค์ ์ฐ์๋ ๋ฉ๋ชจ๋ฆฌ ๋ธ๋ญ์ผ๋ก ์กํ ๊ตฌ์กฐ์ฒด ๋ฉค๋ฒ์ ์ ๊ทผํ ๋ .์ด์ฉํด์ ์ ๊ทผ tStudent.iKor = 100; strcpy_s ํจ์ strcpy_s(tStudent.strName, "๊ฐ๋๋ค๋ผ abcd"); : ๋ฌธ์์ด ๋ณต์ฌํ๊ธฐ : ์ค๋ฅธ์ชฝ์ ์๋ ๋ฌธ์์ด์ ์ผ์ชฝ์ผ๋ก ๋ณต์ฌ : ๋ฌธ์์ด์ ๋์ ํญ์ 0(null)๋ก ๋๋์ผ ํ๋ค : ๊ฐ ๋ฐฐ์ด์์์ ๊ฐ ๋ฃ์ด์ฃผ๋ฉด ๊ทธ ๊ฐ ์ถ๋ ฅ : ๋ฃ์ด์ฃผ์ง ์์ ๊ฐ ๋ถ๋ถ์ ์ฐ๋ ๊ธฐ๊ฐ ์ถ๋ ฅ : strcpy_s ๋ ์..
=> C++ Let's Make Games ๐ซง ๋น๊ณ ๊ฒ์ AI Hard Mode #include #include using namespace std; enum AI_MODE { AM_EASY = 1, AM_HARD }; enum LINE_NUMBER { LN_H1, LN_H2, LN_H3, LN_H4, LN_H5, LN_V1, LN_V2, LN_V3, LN_V4, LN_V5, LN_LT, LN_RT, }; int main() { srand((unsigned int)time(0)); int iNumber[25] = {}; int iAINumber[25] = {}; // 1~25 ์ซ์ ๋ฃ๊ธฐ for (int i = 0; i < 25; i++) { iNumber[i] = i + 1; iAINumber[i] = i..
=> C++ Let's Make Games ๐ซง ๋น๊ณ ๊ฒ์ AI Easy Mode #include #include using namespace std; enum AI_MODE { AM_EASY = 1, AM_HARD }; int main() { srand((unsigned int)time(0)); int iNumber[25] = {}; int iAINumber[25] = {}; // 1~25 ์ซ์ ๋ฃ๊ธฐ for (int i = 0; i < 25; i++) { iNumber[i] = i + 1; iAINumber[i] = i + 1; } // ์ซ์ ์๊ธฐ int iTemp, idx1, idx2; for (int i = 0; i < 100; ++i) { idx1 = rand() % 25; idx2 = rand() ..