Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need some help with this programming challenge. One of the problems that I am

ID: 3788432 • Letter: I

Question

I need some help with this programming challenge.

One of the problems that I am having is converting the vector of ints to a vector of class objects. Please help.

http://pastebin.com/1D39BDb2

Included are the main.cpp, record.hpp, and a sample input.txt file.

Reads all the numbers from a file. The first line in the file tells your program how many numbers to read. The remaining lines in the file are the numbers to read. Use the file linked here E as your example while writing this assignment. You should hard-code the name of the file to read as "input.txt. While reading the numbers from the file, you need to keep track of the unique numbers in the file and create a Record instance for each one. As you read a number, check the current set of records for that number; you must do this using a binary search. If the number exists, increment the frequency by 1 on the existing record. If the number does not exist, create (dynamically allocate) a new Record instance and insert it into the correct location in your array. You need to keep this array in sorted order to ensure your binary search works correctly. o You need to store the Record classes into an std:vector. o std: vector has an insert method you can use to insert a record. For example, the code to insert at position 6, looks like: myVector.insert myvector.begin 6, some value); The myVector.beginCD tells the vector the starting position to begin counting from, then the 6 tells it where to count to.

Explanation / Answer

I will explain to create vector of class objects with an example.

Start with something simpler so you can get the hang of it.

First, create a vector of primitive ints:

Compiling it:

Running it:

Create a vector of class objects in a similar way as above:

Which should print: