Question: I am having trouble with this code. It won't compile: #include #include #include #include CSVparser.hpp using namespace std; //============================================================================ // Global definitions visible to all

I am having trouble with this code. It won't compile:

#include #include #include

#include "CSVparser.hpp"

using namespace std;

//============================================================================ // Global definitions visible to all methods and classes //============================================================================

// The forward declarations double strToDouble(string str, char ch);

// The structure to hold bid information struct Bid { string bidId; // unique identifier string title; string fund; double amount; Bid() { amount = 0.0; } };

//============================================================================ // Static methods used for testing //============================================================================

//The display for the bid information void displayBid(Bid bid) { cout

//The user bid information Bid getBid() { Bid bid;

cout

cout

cout > bid.fund;

cout

return bid; }

// The CSV file containing bids

vector loadBids(string csvPath) { cout

vector bids;

csv::Parser file = csv::Parser(csvPath);

try { for (int i = 0; i

cout

bids.push_back(bid); } } catch (csv::Error &e) { std::cerr

//The bid title information int partition(vector& bids, int begin, int end) {

int low, high, pivot, check; low = begin; high = end;

pivot = (begin + (end - begin) / 2); check = false;

return vector;

while (!check) {

while (bids[low].title.compare(bids[pivot].title)

while (bids[pivot].title.compare(bids[high].title)

}

if (low >= high) { check = true;

}

else { void swap(bids[low], bids[high]);

++low; --high;

}

}

return high;

}

}

//The sort of the bids void quickSort(vector& bids, int begin, int end) { unsigned int divideHalf = 0;

if (begin >= end) { return;

}

divideHalf = partition(bids, begin, end);

quickSort(bids, begin, divideHalf);

quickSort(bids, divideHalf + 1, end);

}

//The sort of the bid titles void selectionSort(vector& bids) {

unsigned int low, high; high = bids.size();

for (unsigned index = 0; index

for (unsigned j = index + 1; j

}

}

if (low != index) void swap(bids[index], bids[low]);

}

}

}

double strToDouble(string str, char ch) { str.erase(remove(str.begin(), str.end(), ch), str.end()); return atof(str.c_str());

}

//The main command line arguments int main(int argc, char* argv[]) { string csvPath; switch (argc) { case 2: csvPath = argv[1]; break; default: csvPath = "eBid_Monthly_Sales_Dec_2016.csv"; }

vector bids;

clock_t ticks;

int choice = 0; while (choice != 9) { cout > choice;

switch (choice) {

//The cases for the variables case 1:

ticks = clock();

bids = loadBids(csvPath);

cout

ticks = clock() - ticks; cout

break;

case 2:

for (int i = 0; i

break;

case 3: selectionSort(bids); cout

break;

case 4: quickSort(bids, 0, bids.size() - 1); cout

}

}

cout

return 0;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!