ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Can someone complete the following C++ program?

184 folders named (1-184) text file with184 lines The program should rename the folders and replace them with new name (the lines inside the text file) #include <iostream> #include <fstream> #include <string> #include <dirent.h> using namespace std; int main() { DIR * dir = opendir("J:\\Folder_Name\\") ifstream inFile ("desiredName.txt"); string line, oldFile, newFile; inFile.open(); if (!dir) cout << "Error opening directory." << endl; else { struct dirent *entry; while (entry = readdir(dir)) { oldFile = entry->d_name; if ( !inFile.is_open() ) cout << "Failed to open input file." << endl; else { getline(inFile, line); cout << line << endl; newFile = line; } if (newFile.size() ==0; cout << "File read error." << endl; //here is where I get stuck

user-image
تم إضافة السؤال من قبل Adeeb Haddad , Independent Freelance Translator , Independent
تاريخ النشر: 2013/12/31
Yogesh Dhakad
من قبل Yogesh Dhakad , Director Technical , Timeless Horizon Engineering Solutions

a) Pl structure the code properly before you submit your question.

b) Such simple things deserve to use a simple language like "python".

c) C++ can ultimate do everything so look at my a). Resubmit.

KASHIF ZEESHAN
من قبل KASHIF ZEESHAN , Corporate Trainer , ORION EDUTECH PVT LTD

Is this the complete program only edits required or you want it to be structured with more cases and statements

 

المزيد من الأسئلة المماثلة