Use Big File
This commit is contained in:
parent
e6fedd165e
commit
dbdd4ade8e
@ -29,6 +29,13 @@ std::string readFile(std::string &fileName, std::vector<ProductSale*> &allSales)
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printAllSales(std::vector<ProductSale*> &allSales) {
|
||||||
|
for (int i = 0; i < allSales.size(); ++i) {
|
||||||
|
std::cout << allSales[i]->toString() << std::endl;
|
||||||
|
std::cout << "==============" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void deleteAllPointers(std::vector<ProductSale*> &allSales) {
|
void deleteAllPointers(std::vector<ProductSale*> &allSales) {
|
||||||
for (auto it = allSales.begin(); it != allSales.end(); it++) {
|
for (auto it = allSales.begin(); it != allSales.end(); it++) {
|
||||||
delete (*it);
|
delete (*it);
|
||||||
@ -98,7 +105,7 @@ void getOnlineVsOfflineIn(std::string country, std::vector<ProductSale*> &allSal
|
|||||||
|
|
||||||
int OnlineCounter = TypeCounter["Online"];
|
int OnlineCounter = TypeCounter["Online"];
|
||||||
int OfflineCounter = TypeCounter["Offline"];
|
int OfflineCounter = TypeCounter["Offline"];
|
||||||
double ratio = (OfflineCounter==0) ? 100.0: OnlineCounter/OfflineCounter;
|
double ratio = (OfflineCounter == 0) ? 100.0 : static_cast<double>(OnlineCounter) / OfflineCounter * 100.0;
|
||||||
|
|
||||||
std::cout << "Online : " << OnlineCounter << std::endl << "Offline : " << OfflineCounter << std::endl;
|
std::cout << "Online : " << OnlineCounter << std::endl << "Offline : " << OfflineCounter << std::endl;
|
||||||
std::cout << "Ratio : " << ratio << "% Online" << std::endl << std::endl;
|
std::cout << "Ratio : " << ratio << "% Online" << std::endl << std::endl;
|
||||||
@ -108,13 +115,11 @@ void getOnlineVsOfflineIn(std::string country, std::vector<ProductSale*> &allSal
|
|||||||
void Aufg8Main() {
|
void Aufg8Main() {
|
||||||
std::vector<ProductSale*> allSales;
|
std::vector<ProductSale*> allSales;
|
||||||
std::string fileName = "../Aufg8/IO-Files/sales_records_small.csv";
|
std::string fileName = "../Aufg8/IO-Files/sales_records_small.csv";
|
||||||
|
fileName = "../Aufg8/IO-Files/DANGER-1500000SalesRecords.csv";
|
||||||
|
|
||||||
readFile(fileName, allSales);
|
readFile(fileName, allSales);
|
||||||
|
|
||||||
for (int i = 0; i < allSales.size(); ++i) {
|
// printAllSales(allSales);
|
||||||
std::cout << allSales[i]->toString() << std::endl;
|
|
||||||
std::cout << "==============" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string selectedRegion;
|
std::string selectedRegion;
|
||||||
std::string selectedType;
|
std::string selectedType;
|
||||||
@ -129,7 +134,7 @@ void Aufg8Main() {
|
|||||||
while (currentMenu) {
|
while (currentMenu) {
|
||||||
switch (currentMenu) { // TODO Finish these
|
switch (currentMenu) { // TODO Finish these
|
||||||
case 0:
|
case 0:
|
||||||
return;
|
return; // To quit the programm
|
||||||
case 1:
|
case 1:
|
||||||
// getTotalProfitFor(*selectedType);
|
// getTotalProfitFor(*selectedType);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user