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

Write C++ code that reads from a text file \"Sales.txt\" into an array of struct

ID: 3529845 • Letter: W

Question

Write C++ code that reads from a text file "Sales.txt" into an array of structs. Then sort the array by venue name, Alphabetically. Send the sorted array to an output file named "Results.txt" Sample "Sales.txt" : Bestbuy 5 10.50 8 4.75 2 1.50 Walmart 10 2.00 30 1.75 5 2.65 Target 23 11.35 50 1.00 14 14.50 WorldFair 12 11.24 5 5.25 9 3.50 CDUniverse 5 15.00 6 3.54 9 4.35

Explanation / Answer

#include #include #include using namespace std; struct employees { int id; string lname; double qtrSale[4]; double tsale; }; void getIdName(employees list[], ifstream& infile, int num); int main() { ifstream infile; string file("file1.txt"); infile.open(file); employees list[lsize]; getIdName(list, infile, lsize); /*getData(list, file, lsize);*/ for(int i = 0; i qtr >> amount; if(list[j].id == id && qtr == 1) { list[j].qtrSale[i] = amount; } if(list[j].id == id && qtr == 2) { list[j].qtrSale[i] = amount; } if(list[j].id == id && qtr == 3) { list[j].qtrSale[i] = amount; } if(list[j].id == id && qtr == 4) { list[j].qtrSale[i] = amount; } } } } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote