I need some help. This program needs to be able to read sales data from a text file. The items it needs are a product number which is an integer, a product name which is a string no longer than 12 characters and which does not contain spaces, a unit price which is a sold, a number of units sold which is an integer. I have done all these things and cannot get it to read properly from the text file. :/
int main() {
ifstream salesFile;
string productName;
int unitsSold, productNumber;
double unitPrice;
Data* productArray[100];
Data* aProduct;
int numProduct = 0;
salesFile.open("sales.txt");
> The items it needs are a
>> product number which is an integer,
>> a product name which is a string no longer than 12 characters and which does not contain spaces,
>> a unit price which is a sold,
>> a number of units sold which is an integer.
So,
a) why are you reading productName first, when apparently the first field is a number.
b) why are you reading produceName twice.
You start with this, to convince yourself that you can read the file properly and consistently.
//Coded by: Mitchell Godbold
// This program will allow you to read sales data from a given text file and which will display the name and revenue
// of the top two selling products given.
So I FINALLY figured out the issue but I still need to figure out where to place a bubble sort in the program to sort them by revenue and then find a spot to place a function to find the first highest revenue and the second. If you could help me figure out the code for these or even where to place them it would be a major help