I have been given an assignment and i dont know how to write the code for it. Most of the code written below was given to us by our tutor, the problem is I dunno how to add and update a new stock item, can some please help me i will be eternally grateful
// ProjCarStock.cpp : Defines the entry point for the console application.
//
struct carStock
{
int carStockNo; //autimatically assigned ascending from 1000
char model[26]; // between 3 - 25 chars
char make; // A - Audi, M - Mercedes, V - VolksWagon, F - Ford
char regNo[9]; // 8 chars at least 1 number / 2 digits
double costPrice; // £250 -- £20000
double sellingPrice; // £450 -- £27000
};
//Prototypes -common functions
void press_key(HANDLE hdl, int col, int row);
void message(HANDLE hdl, char mess[], int col, int row);
char again(HANDLE hdl, int col, int row);
void set_menu(HANDLE hdl );
int get_option(HANDLE hdl, int c , int r , int min , int max);
void gotoXY( HANDLE hdl, SHORT x, SHORT y );
int createArray(HANDLE hdl, struct carStock cars[ ]);
void menu(HANDLE hdl);
void display (HANDLE hdl, struct carStock cars[ ], int size);// Display all
void displayCat (HANDLE hdl, struct carStock cars[ ], int size);// Display by regNo
void add (HANDLE hdl, struct carStock cars[ ], int & size);// Add carStockDetails
void update (HANDLE hdl, struct carStock cars[ ], int size);// Update carStockDetails
void getscreen (HANDLE hdl, char name[]);
void toUpperCase (char s1[]);
void toLowerCase (char s1[]);
void carStockHeading(HANDLE hdl); //Headings
gotoXY(hdl, 10,5); cout<<"Enter the model of the car";
gotoXY(hdl, 14,6); cin>>model;
gotoXY(hdl, 10,7); cout<<"Enter the make of the car";
gotoXY(hdl, 14,8); cin>>make;
gotoXY(hdl, 10,9); cout<<"Enter the registration number";
gotoXY(hdl, 14,10);cin>>reg;
gotoXY(hdl, 10,11);cout<<"Enter the cost of the car";
gotoXY(hdl, 14,12);cin>>costPrice;
gotoXY(hdl, 10,13);cout<<"Enter the selling price of the car";
gotoXY(hdl, 14,14);cin>>sellingPrice;
_getche();
return;
}
void displayCat (HANDLE hdl, struct carStock cars[ ], int size)// display carStock details by regNo
{
int x;
int page=0;
char cat[2];
system("cls");
//complete code
press_key(hdl, 1,26);
}
void display (HANDLE hdl, struct carStock cars[ ], int size)//display all carStock details
{
int x;
int page=0;
int get_option(HANDLE hdl, int min, int max, int col, int row)
{
int x;
do
{
gotoXY(hdl, col, row); cout << "_";
gotoXY(hdl, col, row); cin >> x;
if ( x < min || x > max) message(hdl ,"Invalid Menu Option", 30,23);
}while ( x<min || x > max);
return x;
}
void press_key( HANDLE hdl, int col, int row)
{
gotoXY(hdl, col,row);
cout << "Press Key ";
_getche();
}
void message(HANDLE hdl, char message[], int col, int row)
{
int x;
gotoXY(hdl, col,row);
cout << message;
press_key(hdl, col,row+1);
gotoXY(hdl, col,row);
for( x=0; x < strlen(message) ; x++)
cout << " ";
gotoXY(hdl, col,row+1);
cout << " ";
}
char again(HANDLE hdl, int col, int row)
{
char ch;
gotoXY(hdl, col,row); ch = _getche();
ch = toupper(ch);
while( ch !='Y' && ch !='N')
{
message(hdl,"Must Enter Y or N", 30,23);
gotoXY(hdl, col,row); cout << "_";
gotoXY(hdl, col,row); ch = _getche();
ch = toupper(ch);
}
return ch;
}
void gotoXY( HANDLE hdl, SHORT x, SHORT y )
{
// Set the cursor position.
COORD Cord;
Cord.X = x;
Cord.Y = y;
SetConsoleCursorPosition( hdl, Cord );
}