Skip to content

Commit 73e1fc2

Browse files
authored
Fixed merge issue in dbdata.cpp (#1501)
1 parent b428360 commit 73e1fc2

File tree

1 file changed

+1
-51
lines changed
  • DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/db/src

1 file changed

+1
-51
lines changed

DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/db/src/dbdata.cpp

+1-51
Original file line numberDiff line numberDiff line change
@@ -904,56 +904,6 @@ void Database::PrintQ9(std::array<DBDecimal, 25 * 2020>& sum_profit) {
904904

905905
}
906906

907-
//
908-
// print the results of Query 9
909-
//
910-
void Database::PrintQ9(std::array<DBDecimal, 25 * 2020>& sum_profit) {
911-
// row of Q9 output for local sorting
912-
struct Row {
913-
Row(std::string& nation, int year, DBDecimal sum_profit)
914-
: nation(nation), year(year), sum_profit(sum_profit) {}
915-
std::string nation;
916-
int year;
917-
DBDecimal sum_profit;
918-
919-
void print() {
920-
std::cout << nation << "|" << year << "|"
921-
<< (double)(sum_profit) / (100.0 * 100.0) << "\n";
922-
}
923-
};
924-
925-
// create the rows
926-
std::vector<Row> outrows;
927-
for (unsigned char nat = 0; nat < kNationTableSize; nat++) {
928-
std::string nation_name = n.key_name_map[nat];
929-
for (int y = 1992; y <= 1998; y++) {
930-
outrows.push_back(Row(nation_name, y, sum_profit[y * 25 + nat]));
931-
}
932-
}
933-
934-
// sort rows by year
935-
std::sort(outrows.begin(), outrows.end(),
936-
[](const Row& a, const Row& b) -> bool {
937-
return a.year > b.year;
938-
});
939-
940-
// sort rows by nation
941-
// stable_sort() preserves the order of the previous sort
942-
std::stable_sort(outrows.begin(), outrows.end(),
943-
[](const Row& a, const Row& b) -> bool {
944-
return a.nation < b.nation;
945-
});
946-
947-
// print the header
948-
std::cout << "nation|o_year|sum_profit\n";
949-
950-
// print the results
951-
std::cout << std::fixed << std::setprecision(2);
952-
for (int i = 0; i < outrows.size(); i++) {
953-
outrows[i].print();
954-
}
955-
}
956-
957907
//
958908
// print the results of Query 11
959909
//
@@ -1005,4 +955,4 @@ void Database::PrintQ12(std::string& SM1, std::string& SM2,
1005955
// Restore the output format of cout
1006956
std::cout.copyfmt(oldState);
1007957

1008-
}
958+
}

0 commit comments

Comments
 (0)