// 文件 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]);
}
}
}
}