C++ assignment – I am stuck on code that will pull data from aninventory.dat file and display all items.
Below is my code. I have indicated with a comment in the codewhere I’m having a problem at.
#include
#include
#include
#include
using namespace std;
const int DESC_SIZE = 40;
struct Product
{
long prodNum;
char prodName[DESC_SIZE];
double price;
int qty;
};
//function prototypes
int showMenu();
void printFile(fstream&);
void displayRecord(fstream&);
void modifyRecord(fstream&);
//main function
int main()
{
long choice;
//declare a fstream file object
fstream inventory;
do
{
cjpoce =, emi();
switch choice
{
case 1: //Display product inventory file
printFile(inventory);
break;
case 2: //Display a particular product
displayRecord(inventory);
break;
case 3: //Modify a product
modifyRecord(inventory);
break;
default: //Invalid selection
cout << “Invalid selection.” << endl;
}
while (choice != 4);
cout << “Thank you. Good bye.” << endl;
inventory.close();
system(“pause”);
return 0;
}
// function that prompts user to
PayPal Gateway not configured
PayPal Gateway not configured