// 文件 a.h #include #include

void outstr(std::string str, long ping, const std::vector& exclude = std::vector(), bool canSkip = true);

// 文件 a.cpp #include "a.h" #include #include #include #include <conio.h> #include <Windows.h>

void outstr(std::string str, long ping, const std::vector& exclude, bool canSkip) { for (size_t x = 0; x < str.size(); x++) { if (_kbhit() && canSkip) { printf("%s", str.substr(x, str.size() - x).c_str()); } else { bool isExcluded = false; for (char tmp : exclude) { if (tmp == str[x]) { isExcluded = true; break; } } if (!isExcluded) { printf("%c", str[x]); Sleep(ping); } else { printf("%c", str[x]); } } } }

C++23 报错纠正:outstr 函数优化示例

原文地址: https://www.cveoy.top/t/topic/qcNP 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录