CS161 - Image File Parser - C++ using QTCreator Assignment Instructions Submit file: assign5.cpp I should be able to com

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

CS161 - Image File Parser - C++ using QTCreator Assignment Instructions Submit file: assign5.cpp I should be able to com

Post by answerhappygod »

CS161 - Image File Parser - C++ using
QTCreator
Assignment Instructions
Submit file: assign5.cpp
I should be able to compile and run your program with:
Write a program that extracts information from a text file
containing information about images on a website.
Your program should read from a file called "Images.txt" which
will consist of an unknown number of lines. Each line consists of
an image URL (web address), an MD5 hash identifying the image, and
a file size in bytes. Here is what a line might look like:
Note that the URL consists of http://smugmug.com/thumbs/
followed by a filename (Lacus.jpeg) including extension, then a
question mark and the width (170) and height (330) of the image. Do
not count on the extension or the width & height being a
specific length.
Make sure that you read the right input file name.
Capitalization counts!
Do not use a hard-coded path to a particular directory, like
"C:\Stuff\Images.txt". Your code must open a file that
is just called "Images.txt".
Do not submit the test file; I will use my own.
Here is a sample data file you can use during development. Note
that this file has 5 lines, but when I test your program I will not
use this exact file. You cannot count on there always being exactly
5 images. The file will end with an empty line (like the sample
file). Make sure to test your program with more/fewer lines than
5.
Cs161 Image File Parser C Using Qtcreator Assignment Instructions Submit File Assign5 Cpp I Should Be Able To Com 1
Cs161 Image File Parser C Using Qtcreator Assignment Instructions Submit File Assign5 Cpp I Should Be Able To Com 1 (34.58 KiB) Viewed 34 times
Your program should print out a well organized table that for
each image shows: the filename, image type (the file extension),
the width, the height and the size in kB (1024 bytes in a kB)
rounded to one decimal place. It should then display the total size
in kB of the images.
Hints:
Make sure you can open the file and read something before trying
to solve the whole problem. Get your copy of Images.txt stored in
the folder with your code, then try to open it, read in the first
string (http://smugmug.com/thumbs/Lacus.jpeg?170x330), and just
print it out. Until you get that working, you shouldn't be worried
about anything else.
Work your way to a final program. Maybe start by just handling
one line. Get that working before you try to add a loop. And
initially don't worry about chopping up what you read so you can
print the final data, just read and print. Worry about adding code
to chop up the strings you read one part at a time.
Remember, my test file will have a different number of
lines.
If you need to turn a string into an int or a double, you can
use this method:
If you need to turn an int or double into a string use
to_string()
Please answer with actual code, not a picture of an essay, it
really doesn't help writing things down on paper and submitting a
photo of it, usually because it is so blurry I can't read it!
Anyways, actual code please, will upvote if correct, thank you!
http://smugmug.com/thumbs/Lacus.jpeg?170x330 44cf8edbd53cf75be874604b39a76940 21990 Note that the URL consists of http://smugmug.com/thumbs/ followed by a filename (Lacus.jpeg) including extension, then a question mark and the width (170) and height (330) of the image. Do not count on the extension or the width & height being a specific length.

Sample output Name Width Size Type jpeg tiff Height 330 170 21.5 300 220 10.4 1080 720 58.6 Lacus.jpeg Vel.tiff ElementumNullam.png MontesNasceturRidiculus.gif AtLorem.jpeg Total Size: png gif jpeg 180 101.5 2200 240 200 21.6 213.5
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply