1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
class CTool
{
int record, quantity;
char name[30];
double cost;
public:
CTool (int r = 0, int q = 0, char n[30] = "", double c = 0.0) : record(r), quantity(q), cost(c)
{ strcpy_s(name, n); }
friend istream& operator >> (istream&, CTool&);
friend ostream& operator << (ostream&, const CTool&);
int getRecord() { return record; }
double getNum();
void setTool(int r)
{
cin.ignore(30,'\n');
record = r;
cout << "\nEnter tool name: ";
cin.getline(name,30);
cout <<"\nEnter quantity: ";
quantity = static_cast<int>(getNum());
cout <<"\nEnter cost: ";
cost = getNum();
}
};
int fileMenu();
int inventoryMenu();
bool getValidRecord(int&);
bool isYes();
double getNum();
void handleNewRecord(fstream&, CTool, int);
void handleUpdateRecord(fstream&, CTool, int);
void handleDeleteRecord(fstream&, CTool, int);
void printRecord(fstream&, CTool, int);
void initializeSUD(fstream& f, CTool& t);
|