你可以使用一个字符串数组来保存多个文件地址。以下是一个示例代码:

#include <iostream>
#include <string>

using namespace std;

int main() {
    const int NUM_FILES = 3;
    string fileNames[NUM_FILES];

    for (int i = 0; i < NUM_FILES; i++) {
        cout << 'Enter file ' << i + 1 << ' name: ';
        cin >> fileNames[i];
    }

    cout << 'File names entered:
';
    for (int i = 0; i < NUM_FILES; i++) {
        cout << fileNames[i] << endl;
    }

    return 0;
}

在这个示例中,我们声明了一个名为'fileNames'的字符串数组,它可以保存'NUM_FILES'个文件地址。然后,我们使用一个循环来提示用户输入每个文件的名称,并将其存储在'fileNames'数组中。最后,我们遍历'fileNames'数组以显示用户输入的文件名。

C++ 保存多个文件地址

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

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