Question: Define an Order class with (customer) name, address, data, and vector members. Purchase is a class with a (product) name, unit_price, and count members. Define
Define an Order class with (customer) name, address, data, and vector members. Purchase is a class with a (product) name, unit_price, and count members. Define a mechanism for reading and writing Orders to and from a file. Define a mechanism for printing Orders. Create a file of at least ten Orders, read it into a vector, sort it by name (of customer), and write it back out to a file. Create another file of at least ten Orders of which about a third are the same as in the first file, read it into a list, sort it by address (of customer), and write it back out to a file. Merge the two files into a third using std::merge().
Step by Step Solution
3.44 Rating (160 Votes )
There are 3 Steps involved in it
During the test of the program i found one error which surprised me that it compiled In Orderh i created a template function template void writetofileconst stdstring filename const Orders orders If i run this function in the Ordertestcpp without template argument like this writetofilefirstsortedbycustomernamefilename firstorders it still compiles Is the argument optional because its deduced by the passed argument I changed it back to writetofile ... View full answer
Get step-by-step solutions from verified subject matter experts
