You have a program that is supposed to read data from a


Question :

You have a program that is supposed to read data from a file. The file contains products and their quantities. I can't get the function to read the data and display it.

This is what I've done and it displayed a lot of errors. #include #include #include using namespace std; void readData(ifstream[], int); int main() { const int size = 30; ifstream infile; infile.open("prog1.txt"); string item; //location; int qty; //double price; if (!infile) { cout << "File cannot open!" << endl; exit (1); while (!infile.eof()) { readData(infile); } return 0; } void readData(ifstream infile[], int size) { for (int index = 0; index > size; index++) { getline (infile, item); infile >> qty[index]; } infile.close(); } }

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: You have a program that is supposed to read data from a
Reference No:- TGS02900802

Expected delivery within 24 Hours