Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.In this program its job is to reads the data from a text file the data from the text file is about files and folders

1.In this program its job is to reads the data from a text file the data from the text file is about files and folders stored in a storage device, here is the code I have done:

#include #include #include using namespace std; class Data_Struct { private: vectorlines; // vector of string which stores the file line by line public: void loadFromFile(string fileName)// this function reads the txt file and stores the content line by line in the lines vector { string str; // for taking input ifstream Data_Struct; // variables for reading the file Data_Struct.open(fileName); // opeining the file if(!Data_Struct)// if file could not open then error msg is printed { cout

char getNumber(string line) // getting the ID number from the first line of file { return line[1]; } };

#include #include #include "Data_Struct.h" using namespace std;

int main() {

string fileName = "file.txt";// file name is stored in the filename variable Data_Struct dataStruct;// creating the object of the file class dataStruct.loadFromFile(fileName);// reading the contents dataStruct.printlines();// printing the contents of the file

return 0; }

Here is the output: [0][Root][0][T][0] the ID number is:0 [1][file.txt][45643][F][0] the ID number is:1 [2][folder1][0][T][0] the ID number is:2 [3][file2.txt][7346][F][2] the ID number is:3

now I wish to put this data in a binary three using the id number of each number. The problem is that the root has to begin with 0. And after that the program should list search delete and add files or folders through the binary three. The program must be written in c++ object oriented

image text in transcribed

image text in transcribed

image text in transcribed

pls ignore the images !!!!!
1. In this pro i ts job is to read Here is the code I have done the data from a text file the data from the text file is about Files and folders stored in storage devices include lines Il vector of string which stores the File line by line public vold lead role(String Fil l this function reads the txt file and stores the content line by line in the lines vector strinstri 17 for taking input Ifstre Data Struct Variables for reading the file Data Struct.open(FileName) // opeinint the file IF(Data Struct// If file could not open the error cout include include lines; // vector of string which stores the file line by line public: void loadFromFile(string fileName) // this function reads the txt file and stores the content line by line in the lines vector string str; // for taking input ifstrean Data Struct; // variables for reading the file Data Struct.open(FileName); // opening the file if (Data Struct)// If file could not open then error 15 printed cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions