Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461 (Type in fields) Keenan
Optimized C++
Programming Assignment
1
PA7 – File System
Integrity Policy: All university integrity and class syllabus policies have been followed. I have neither given, nor
received, nor have I tolerated others’ use of unauthorized aid.
I understand and followed these policies: Yes No
Name:
Date:
Final Changelist number:
Verified build: Yes No
Number Tests Passed:
Required Configurations:
GRAD or UNDERGRAD:
Discussion (What did you learn):
Student Information
Submission Details
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461 (Type in fields) Keenan
Optimized C++
Programming Assignment
2
• Follow the Piazza procedure on submission
o Verify your submission compiles and works at the changelist number.
• Verify that only MINIMUM files are submitted
o No – Generated files
*.pdb, *.suo, *.sdf, *.user, *.obj, *.exe, *.log, *.pdb, *.db, *.user
Anything that is generated by the compiler should not be included
o No – Generated directories
/Debug, /Release, /Log, /ipch, /.vs
• Typical files project files that are required
o *.sln, *.cpp, *.h
o *.vcxproj, *.vcxproj.filters, CleanMe.bat
Submit multiple times to Perforce
• Submit your work as you go to perforce several times (at least 5)
o As soon as you get something working, submit to perforce
o Have reasonable check-in comments
Points will be deducted if minimum is not reached
Write all programs in cross-platform C++
• Optimize for execution speed and robustness
• Working code doesn’t mean full credit
Submission Report
• Fill out the submission Report
o No report, no grade
Code and project needs to compile and run
• Make sure that your program compiles and runs
o Warning level ALL …
o NO Warnings or ERRORS
Your code should be squeaky clean.
o Code needs to work “as-is”.
No modifications to files or deleting files necessary to compile or run.
o All your code must compile from perforce with no modifications.
Otherwise it’s a 0, no exceptions
Project needs to run to completion
• If it crashes for any reason…
o It will not be graded and you get a 0
Verify Builds
Standard Rules
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461 (Type in fields) Keenan
Optimized C++
Programming Assignment
3
No Containers
• NO STL allowed {Vector, Lists, Sets, etc…}
o No automatic containers or arrays
o You need to do this the old fashion way – YOU EARNED IT
Leave Project Settings
• Do NOT change the project or warning level
o Any changing of level or suppression of warnings is an integrity issue
Simple C++
• No modern C++
o No Lambdas, Autos, templates, etc…
o No Boost
• NO Streams
o Used fopen, fread, fwrite…
• No code in MACROS
o Code needs to be in cpp files to see and debug it easy
• Exception:
o implicit problem needs templates
Leaking Memory
• If the program leaks memory
o There is a deduction of 20% of grade
• If a class creates an object using new/malloc
o It is responsible for its deletion
• Any MEMORY dynamically allocated that isn’t freed up is LEAKING
o Leaking is HORRIBLE, so you lose points
No Debug code or files disabled
• Make sure the program is returned to the original state
o If you added debug code, please return to original state
• If you disabled file, you need to re-enable the files
o All files must be active to get credit.
o Better to lose points for unit tests than to disable and lose all points
No Adding files to this project
• This project will work “as-is” do not add files…
• Grading system will overwrite project settings and will ignore any student’s added files and
will returned program to the original state
UnitTestConfiguration file (if provided) needs to be set by user
• Grading will be on the UnitTestConfiguration settings
o Please explicitly set which tests you want graded… no regrading if set incorrectly
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461 (Type in fields) Keenan
Optimized C++
Programming Assignment
4
• See Piazza for due date and time
• Submit program perforce in your student directory assignment supplied.
• Fill out your this Submission Report and commit to perforce
o ONLY use Adobe Reader to fill out form, all others will be rejected.
o Fill out the form and discussion for full credit.
• Learn
o File Basics
fopen, fread, fclose, fseek,
(hopefully it’s a review)
o Load a dynamic memory in-place file for fast reload and run
o Sorting linked lists
Merge, Insertion, combination techniques
• Please VERIFY the correct builds for each project
Section 1: EVERYONE Sorting exercise
• Add your methods to SearchList class
o You can add additional helper methods
o Do not add extra data to the class
• Create 3 sorting routines for double linked lists
o Insertion sort
1. Use this as reference material,
1. http://quiz.geeksforgeeks.org/insertion-sort-for-singly-linked-list/
2. Port this code into your project
2. Run the benchmark for timings
o Merge sort
1. Use this as reference material,
1. http://www.geeksforgeeks.org/merge-sort-for-linked-list/
2. Port this code into your project
2. Run the benchmark for timings
o Merge / Insertion combo sort
1. Use the above sorts and create a hybrid sort
Due Dates
Goals
Assignments
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461 (Type in fields) Keenan
Optimized C++
Programming Assignment
5
2. Where the list is sorted with Merge, when the sub list get under a certain
cutoff length, it switches into the insertion sort
o Run the benchmark for timings
Section 2: Under Grads only – Basic file load and restore.
• Based on the linked list provided….
• Write code to copy the node data (many nodes) to a single binary file
o Code must be in BINARY mode
1. Only use fopen, fread, ….
2. No Streams allowed
3. No Boost STL
4. No Modern C++
5. Old school – BABY!
6. Make sure its BINARY – not text mode
• Write code to load data from your binary file
o Create methods to write and read data to the file
1. You can add methods and data to FileList class if you want
o Recreate the linked list from your loaded data
• Run validation program
Section 3: Grads only – Write a Load in Place file (Contiguous memory footprint)
• Write Contiguous memory footprint to a new binary file
o add any extra data necessary for pointer fix-up
• Load this data from a binary file into ONE memory block
o perform pointer fix-up
o reconstruction cannot exceed 1-3 new calls
• Run validation program
Section 4: EVERYONE – Do Not submit your binary file
• The file is auto-generated every time the program is executed
Simple checklist to make sure that everything is submitted correctly
• Is the project compiling and running without any errors or warnings?
• Does the project run ALL the unit tests execute without crashing?
• Is the submission report filled in and submitted to perforce?
o Fill out the form (make sure you specify GRAD or UNDERGRAD)
• Follow the verification process for perforce
Validation
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461 (Type in fields) Keenan
Optimized C++
Programming Assignment
6
o Is all the code there and compiles “as-is”?
o No extra files
• Is the project leaking memory?
Most assignments will have hints in a section like this.
• Practice your file system stuff
• Create several example solutions with different file patterns – fopen, fread, fwrite
• Make sure you are using the binary operation and not the text mode.
o ‘wt’ – write text BAD
o ‘wb’ – write binary GOOD
o Same for read
• Look up file read / write examples from the internet or out of the book
o I like the fopen, fwrite way of doing stuff as opposed to the streams.
o Stay with old style for this assignment
• Use the FORUMs
o This is much harder than the last assignment.
o See me during office hours.
o Read, explore, ask questions in class
Hints