From 25d3aea5450d07b344a06c8563e02d158eeef955 Mon Sep 17 00:00:00 2001 From: jiaowobaba02 Date: Mon, 24 Jul 2023 08:59:43 +0900 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'audio=5Fcontrol.cpp'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- audio_control.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 audio_control.cpp diff --git a/audio_control.cpp b/audio_control.cpp new file mode 100644 index 0000000..9f07c3d --- /dev/null +++ b/audio_control.cpp @@ -0,0 +1,65 @@ +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; +void ring(const string& path){ // 修改参数类型为const string& + //响铃命令例:powershell -c (New-Object Media.SoundPlayer 'ring.wav').PlaySync() + string ring_path="powershell -c (New-Object Media.SoundPlayer '"; + if(path=="none"){ + Beep(500,500); + Sleep(200); + Beep(500,500); + Sleep(200); + Beep(500,500); + cout<<"test"<> path; + string line; + while (getline(file, line)) { + // 创建一个字符串流来分割每一行的数据 + stringstream ss(line); + string cell; + // 创建一个一维向量来存储一行的数据 + vector row; + row.clear(); // 清空row向量,避免数据重复和内存浪费 + // 读取每一个单元格 + while (getline(ss, cell, ',')) { + // 把单元格的数据放到一维向量中 + row.push_back(cell); + } + // 把一维向量放到二维向量中 + path.push_back(row); + } + // 关闭文件 + file.close(); // 关闭文件,避免内存泄漏和文件占用 + + assert(!path.empty()); // 判断data是否为空,如果为空,抛出异常 + cout<<"path1"<