├── .gitignore ├── README.md ├── images └── cangjie-logo.png └── samples └── hello_world └── main.cj /.gitignore: -------------------------------------------------------------------------------- 1 | # MSVC Windows builds of cjc generate these, which store debugging information 2 | *.cjo 3 | *.exe 4 | *.bchir2 5 | target/ 6 | cjpm.lock 7 | .vscode/ 8 | .cache/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cangjie Programming Language Tutorial. 《跟老卫学仓颉编程语言开发》 2 | 3 | ![](images/cangjie-logo.png) 4 | 5 | *Cangjie Programming Language Tutorial*, is a book about how to develop Cangjie applications. 6 | 7 | 8 | 9 | 《跟老卫学仓颉编程语言开发》是一本 仓颉编程语言 应用开发的开源学习教程,主要介绍如何从0开始开发 仓颉编程语言 应用。本书包括最新版本 仓颉编程语言 0.53.13 中的新特性。图文并茂,并通过大量实例带你走近 仓颉编程语言 的世界! 10 | 11 | 本书业余时间所著,书中如有错漏之处,敬请斧正。 12 | 13 | 有关HarmonyOS应用开发的内容,可以参考《[跟老卫学HarmonyOS开发](https://github.com/waylau/harmonyos-tutorial)》。 14 | 15 | ## Summary 目录 16 | 17 | 18 | * [仓颉编程语言开发环境搭建(安装仓颉工具链)](https://waylau.com/install-cangjie-lang/) 19 | * [仓颉编程语言开发环境搭建(安装VSCode仓颉插件)](https://waylau.com/install-cangjie-plugin-in-vscode/) 20 | * [DevEco Studio 5.0.1 Beta3安装及配置](https://developer.huawei.com/consumer/cn/forum/topic/0201167060557489345) 21 | * [HarmonyOS NEXT仓颉编程语言开发环境搭建(安装DevEco Studio Cangjie Plugin)](https://waylau.com/install-deveco-studio-cangjie-plugin/) 22 | * [仓颉开发HarmonyOS,报错error: undeclared identifier 'ViewStackProcessor'](https://developer.huawei.com/consumer/cn/forum/topic/0203168734455974805) 23 | * [仓颉开发HarmonyOS,@Builder 和@Component的区别?](https://developer.huawei.com/consumer/cn/forum/topic/0201168738273407796) 24 | * [仓颉开发HarmonyOS,internal import 和import 有什么区别? ](https://developer.huawei.com/consumer/cn/forum/topic/0201168738630513798) 25 | * [“HarmonyOS NEXT+AI大模型打造智能助手APP(仓颉版)”实战课程简介](https://developer.huawei.com/consumer/cn/forum/topic/0207177697979523118) 26 | * [使用鸿蒙仓颉编程语言开发“Hello World”应用](https://developer.huawei.com/consumer/cn/forum/topic/0208178470222403321?fid=0109140870620153026) 27 | * [实战:猜数字游戏](https://developer.huawei.com/consumer/cn/forum/topic/0208178389310767290?fid=0109140870620153026 28 | ) 29 | * [谷歌将 Android OS 转为 “内部开发”,对鸿蒙系统来说是否是个机会?](https://developer.huawei.com/consumer/cn/forum/topic/0204178542373267294?fid=0109140870620153026) 30 | * [【HarmonyOS NEXT+AI】问答01:课程里用的什么大模型?能用DeepSeek吗?](https://developer.huawei.com/consumer/cn/forum/topic/0202179567792367460?fid=0109140870620153026) 31 | * [科技巨头加倍押注生成式 AI](https://developer.huawei.com/consumer/cn/forum/topic/0207179667509011509?fid=23) 32 | * [【HarmonyOS NEXT+AI】问答02:有一点编程基础,可以学不?](https://developer.huawei.com/consumer/cn/forum/topic/0207179750550660521?fid=0109140870620153026) 33 | * [【HarmonyOS NEXT+AI】问答03:找不到DevEco Studio Cangjie Plugin下载链接?](https://developer.huawei.com/consumer/cn/forum/topic/0207180264471291591?fid=0109140870620153026) 34 | * [【HarmonyOS NEXT+AI】问答04:仓颉编程语言适合毕业设计吗? 35 | ](https://developer.huawei.com/consumer/cn/forum/topic/0201181154070287038?fid=0109140870620153026) 36 | * [华为首款鸿蒙电脑正式亮相](https://developer.huawei.com/consumer/cn/forum/topic/0202182086290078559?fid=0109140870620153026) 37 | * [【HarmonyOS NEXT+AI】问答05:ArkTS和仓颉编程语言怎么选?](https://developer.huawei.com/consumer/cn/forum/topic/0204182208074587445?fid=0109140870620153026) 38 | * [HarmonyOS NEXT+AI打造智能助手APP(适配DeepSeek)](https://developer.huawei.com/consumer/cn/forum/topic/0201182544745864038?fid=0109140870620153026) 39 | 40 | ## Samples 示例 41 | 42 | * [Hello World](samples/hello_world) 43 | * [变量与常量](samples/variable_demo) 44 | * [函数](samples/function_demo) 45 | * [注释](samples/comment_demo) 46 | * [流程控制](samples/flow_control_demo) 47 | * [猜数字游戏](samples/guessing_game) 48 | * [操作字符串](samples/string_demo) 49 | * [数组类型](samples/array_demo) 50 | * [将包含句号的句子转为单词](samples/convert_sentences_containing_period_into_words) 51 | * [面向对象的图形](samples/oo_for_shape) 52 | * [猜数字游戏(模式匹配)](samples/pattern_match_guessing_game) 53 | * [“剪刀石头布”游戏](samples/rock_paper_scissors) 54 | * [泛型函数](samples/generic_function_demo) 55 | * [泛型结构体](samples/generic_struct_demo) 56 | * [动物发声模拟器](samples/animal_vocal_simulator) 57 | * [使用ArrayList](samples/arraylist_demo) 58 | * [使用HashSet](samples/hashset_demo) 59 | * [使用HashMap](samples/hashmap_demo) 60 | * [名字的漂亮度](samples/the_beauty_of_the_name) 61 | * [throw和处理异常](samples/exception_demo) 62 | * [“剪刀石头布”游戏的异常处理](samples/rock_paper_scissors_with_exception) 63 | * [带传参的名字的漂亮度](samples/the_beauty_of_the_name_with_parameter) 64 | * [读写文件](samples/basic_io_file_demo) 65 | * [获取文件元数据](samples/file_info) 66 | * [使用HashSet](samples/word_frequency) 67 | * [词频统计](samples/word_frequency) 68 | * [删除字符串中出现次数最少的字符](samples/delete_least_occurring_character_from_string) 69 | * [龟兔赛跑](samples/the_tortoise_and_the_hare) 70 | * [‌多窗口售票](samples/multi_window_ticket_sales) 71 | * [‌宏的入门](samples/macro_introduction_demo) 72 | * [‌快速幂的计算](samples/macro_power) 73 | * [‌‌多行dprint宏](samples/macro_muti_dprint) 74 | * [‌创建TCP服务器](samples/tcp_demo) 75 | * [‌创建UDP服务器](samples/udp_demo) 76 | * [‌构建HTTP服务](samples/http_demo) 77 | * [‌构建REST服务](samples/http_rest_demo) 78 | * [‌CJPM入门](samples/cjpm_demo) 79 | * [‌编写仓颉单元测试用例](samples/unittest_demo) 80 | * [‌编写Mocking框架测试用例](samples/unittest_mock_demo) 81 | * [‌统计仓颉编程语言的运行性能](samples/performance_test_of_accumulator) 82 | * [‌实现KV数据库](samples/kv_store) 83 | * [‌实现雪花算法](samples/snowflake_algorithm) 84 | * [‌实现HarmonyOS瀑布流](samples/CangjieHarmonyOSWaterFlow) 85 | * 未完待续... 86 | 87 | 88 | 89 | ## Get start 如何开始阅读 90 | 91 | 选择下面入口之一: 92 | 93 | * 的 [README.md](https://github.com/waylau/cangjie-programming-language-tutorial/blob/master/README.md) 94 | * 的 [README.md](https://gitee.com/waylau/cangjie-programming-language-tutorial/blob/master/README.md) 95 | 96 | 97 | ## Code 源码 98 | 99 | 书中所有示例源码,移步至的 `samples` 目录下。 100 | 101 | 102 | ## Book 配套书籍、课程 103 | 104 | 105 | 106 | 如果你喜欢本开源书,也欢迎支持下该书的正式出版物,实体店及各大网店有售。 107 | 108 | 109 | * [HarmonyOS NEXT+AI大模型打造智能助手APP(仓颉版)](https://coding.imooc.com/class/927.html)(视频) 110 | 111 | 112 | 113 | 114 | ## Issue 意见、建议 115 | 116 | 117 | 118 | 如有勘误、意见或建议欢迎拍砖 119 | 120 | ## Contact 联系作者 121 | 122 | * Blog: [waylau.com](http://waylau.com) 123 | * Gmail: [waylau521(at)gmail.com](mailto:waylau521@gmail.com) 124 | * Weibo: [waylau521](http://weibo.com/waylau521) 125 | * Twitter: [waylau521](https://twitter.com/waylau521) 126 | * Github : [waylau](https://github.com/waylau) 127 | 128 | ## Support Me 请老卫喝一杯 129 | 130 | ![开源捐赠](https://waylau.com/images/showmethemoney-sm.jpg) 131 | -------------------------------------------------------------------------------- /images/cangjie-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waylau/cangjie-programming-language-tutorial/dfc3a90c6895ec74209edeb01d5ffcdee71c6aa6/images/cangjie-logo.png -------------------------------------------------------------------------------- /samples/hello_world/main.cj: -------------------------------------------------------------------------------- 1 | // main函数最先执行 2 | main() { 3 | // 打印Hello World! 4 | println("Hello World!"); 5 | } --------------------------------------------------------------------------------