This would be much easier with a class that could use some sort of data structure but without you can implement separate arrays for each item type, i.e. an array of movies and an array of CDs. Unless you only need one item type, then use one array obviously.
For each to be accompanied by other information I would use an array of structs so each can hold multiple data types. This was you can enter the other information along with the item in the array and sorting will not affect which item is accompanied by which associated information.
As for sorting there are many available techniques such as bubble or insertion sort the two most likely to have been covered in your course before this point as they are easy to implement.
#include <iostream>
#include <string.h>
usingnamespace std;
int main(){
int choice = 3; // To store the selection of the user when prompted
int listSize = 0; // To store the size of the list
string * titles; // Pointer to a string
float * price; // Pointer to a float
bool quit = false; // To quit when the user wants to
While(quit == false){//Keep doing this loop while the user doesn't want to quit
cout << "Enter '1' to add, '2' to show list, '3' to sort list or '4' to quit: ";
cin >> choice; // Store the choice of the user in choice
if(choice == 4){
// Make the program quit
}
elseif(choice == 2 && listSize != 0){
// Iterate through the arrays titles and price
}
elseif(choice == 1){
// Ask for a title and a price
// If this is the first item in the list then you need to create an array of 1 element
if(listSize == 0){
titles = new string[1]; // makes titles point to an array of strings which we just created
price = newfloat[1]; // makes price point to an array of floats we just created
}
// If this is not the first time then you need to create an array that is one element larger than the existing array.
else{
string * tempString = new string[listSize + 1]; // A temporary pointer to an array we just created
string * tempFloat = new string[listSize + 1];
// Then create a loop to iterate and copy everything in the titles and price arrays in to tempString and tempFloat.
// Then have the last element of tempString and tempFloat store the new entries of the user.
// Now delete titles and price to free up the memory they were occupying
delete [] titles;
delete [] price;
// Make titles and Price equal to tempString and tempFloat
titles = tempString;
price = tempFloat;
tempString = NULL; // Make these NULL pointers
tempFloat = NULL;
}
}
elseif(choice == 3){
// Sort the list.
}
}
cout << "Press Enter" << endl;
cin.ignore(255,'\n'); // Waits for an enter to be pressed before quitting.
return 0;
}