跳到正文

个人记录

会说话的电脑

control_our_own_life约 1 分钟
原文
文章信息与版本

文章信息

发布
2023年4月6日
收录
2025年12月12日
更新
2026年11月14日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include <bits/stdc++.h>
using namespace std;

void speak(string the_world_say) {
	FILE *fp = fopen("%2%speak_c++.vbs", "w");
	string the_vbs_code =
	    "CreateObject(\"Scripting.FileSystemObject\").DeleteFile(WScript.ScriptName)\nCreateObject(\"SAPI.SpVoice\").Speak\"" +
	    the_world_say + "\"";
	fputs(the_vbs_code.c_str(), fp);
	fclose(fp);
	system("%2%speak_c++.vbs");
	return;
}
string str;

int main() {
	while (cin >> str) {
		speak(str);
	}
	return 0;
}
原文