Define a struct called part_rec that has three elements, partnum(string), value(float), quantity(int). Write a function that deletes an element by partnum(unique) from the sorted array of part_rec and keeps the array sorted. It should work for arrays of various sizes. The array is sorted in ascending order.
------------------------------------------------------------------------------
I can define the struct, simple enough. But i am unsure how to delete an element from the array and still keep it sorted. Also how would one cout a struct? If anyone has any ideas I'd love to hear them.
well, you can't delete an element of an array because arrays are not dynamic, however you can copy one element over another.
for example your function could check the elements of the array for a string partnum == "3", then when it finds a match it goes into a loop that copies the next element over the current one until the end of the array is reached. Basically moving each element up one.
Thing is I dont know how to check the array for said value and everything i try errors out because it cannot convert sting to part_rec or something else to part_rec