Question: #include #include #include #include #include struct ImageInfo { string filename; string type; int width; int height; double sizeKB; } ; using namespace std; int main
#include
#include
#include
#include
#include
struct ImageInfo
string filename;
string type;
int width;
int height;
double sizeKB;
;
using namespace std;
int main
ifstream inputFileImagestxt;
if inputFile
cerr "Error: Could not open the file 'Images.txt endl;
return ;
vector images;
string line;
double totalSizeKB ;
while getlineinputFile line
if lineempty
continue;
istringstream lineStreamline;
string url, mdHash;
int sizeBytes;
lineStream url mdHash sizeBytes;
sizet lastSlashPos url.findlastof;
sizet questionMarkPos url.find;
string filename url.substrlastSlashPos questionMarkPos ;
sizet dotPos filename.findlastof;
string type filename.substrdotPos ;
string dimensions url.substrquestionMarkPos ;
sizet xPos dimensions.findx;
int width stoidimensionssubstr xPos;
int height stoidimensionssubstrxPos ;
double sizeKB sizeBytes ;
totalSizeKB sizeKB;
images.pushbackfilename type, width, height, sizeKB;
cout left setw "Filename" setw "Type" setw
"Width" setw "Height" setw "Size KB endl;
cout string endl;
for const auto& image : images
cout left setw image.filename setw image.type
setw image.width setw image.height fixed
setprecision setw image.sizeKB endl;
cout "Total Size: fixed setprecision totalSizeKB KB
endl;
inputFile.close;
return ;
Can someone explain to me what this program does and break it down for me please?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
