i m attempting to read data from a text file in the format plain egg1 45bacon and eg 5121834

I’m attempting to read data from a text file in the format: Plain Egg1.45Bacon and Egg2.45Muffin0.99French Toast1.99Fruit Basket2.49Cereal0.69Coffee0.50Tea0.75 etc…. I’m doing this by attempting to read the data into an arraymenuList[] of type menuItemType, within my function getData, usinga while loop with either ‘eof()’, ‘ifstream’, or ‘ifstream >>variable’ as parameters. The issue is that the while loop stopsafter the first iteration…Source Code: #include #include #include #include #include using namespace std;//Structure Definitionsstruct menuItemType{ string menuItem; // menu item name double menuPrice; // menu item price};//Function prototypevoid getData(menuItemType menuList[], ifstream&);void showMenu(menuItemType menuList[]);//Global Variables//Main Functionint main() { //Declarations & Initializations menuItemType menuList[5]; //Array with datastructure elements of type menuItemType menuItemType menuOrder[] = {}; // Gen Format// cout << fixed << showpoint << setprecision(2); //Output //Process ifstream inFile; //Declare input variable inFile.open(“input.txt”); // open file cout << “Please select from the following items in our menunnnn”; getData(menuOrder, inFile); return 0;}//Function Definitionsvoid getData( menuItemType menuList[], ifstream& inFile){ int i = 0; while (inFile) { getline(inFile, menuList[i].menuItem); cout << setw(10) << left << menuList[i].menuItem; inFile >> menuList[i].menuPrice; cout . . .

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now