fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. // эта функция реализована в windows.h, для иллюстрацию напишем её упрощённую версию
  6. void CopyFile(string existingFileName, string newFileName, bool failIfExists) {
  7. cout << "Copy from " << existingFileName << " to " << newFileName << endl;
  8. }
  9.  
  10. int main() {
  11. vector<string> files = {"one.txt", "two.txt", "three.txt"};
  12. for (string file : files) {
  13. string source = "E://" + file;
  14. string destination = "D://" + file;
  15. CopyFile(source, destination, false);
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Copy from E://one.txt to D://one.txt
Copy from E://two.txt to D://two.txt
Copy from E://three.txt to D://three.txt