I have two different .cpp
files (linked lists) under the same set of sources of the same project. I tried to run one of the linked list files called "client", but it only works with another called "video". How can I run a list of related clients list file?
My customer.cpp
file is active, but it still starts the program for the list file related video.
I am mainly trying to list two separate customer lists and another separate video list.
But when I try to run the program on the customer.cpp tab, I thought that it should have started it, but it was running the video.cpp file ... did I miss something?
#include <iostream> using namespace std; struct video { char title[40],star1[20],star2[20],star3[20],star4[20],prod[20],dir[20],proco[40]; int copy; video *next; }; video *first = NULL, *current = NULL; int optn = 0;
^ this is my nodestructure for video list video.cpp file
#include <iostream> using namespace std; struct customer { char f_name[20],l_name[20]; int acc_num; customer *next; }; customer *start = NULL, *pointer = NULL; int option = 0;
^ This is my sub-structure for a customer-related list. customer.cpp file. both of them are in two separate source files within the same project.
int main(void) { first = NULL; current = NULL; do { display(); cout << endl; cout << "Choose an option: " << endl; cout << "1. Move the current position forward once." << endl; cout << "2. Move the current position backwards once." << endl; cout << "3. Add a video at the beginning of the list." << endl; cout << "4. Add a video at the current position of the list." << endl; cout << "5. Add a video at the ending of the list." << endl; cout << "6. Delete the first video from the list." << endl; cout << "7. Delete the video at current position from the list." << endl; cout << "8. Delete the last video from the list." << endl; cout << "9. End program." << endl; cout << endl << " >> " ; cin >> optn; switch (optn) { case 1 : currentfor(); break; case 2 : currentbac(); break; case 3 : addbeginning(); break; case 4 : addmiddle(); break; case 5 : addending(); break; case 6 : deletebegin(); break; case 7 : deletemiddle(); break; case 8 : deleteend(); break; } } while (optn != 9); }
^ this is the code in which I call all the functions for the video.cpp file.
int mains(void) { start = NULL; pointer = NULL; do { display_menu(); cout << endl; cout << "Choose an option: " << endl; cout << "1. Move the current position forward once." << endl; cout << "2. Move the current position backwards once." << endl; cout << "3. Add a customer at the beginning of the list." << endl; cout << "4. Add a customer at the current position of the list." << endl; cout << "5. Add a customer at the ending of the list." << endl; cout << "6. Delete the first customer from the list." << endl; cout << "7. Delete the customer profile at current position from the list." << endl; cout << "8. Delete the last video from the list." << endl; cout << "9. End program." << endl; cout << endl << " >> " ; cin >> option; switch (option) { case 1 : current_forward(); break; case 2 : current_backward(); break; case 3 : add_beginning(); break; case 4 : add_middle(); break; case 5 : add_ending(); break; case 6 : delete_beginning(); break; case 7 : delete_middle(); break; case 8 : delete_ending(); break; } } while (option != 9); }
^ this is the last code in which I call all the functions for the customer.cpp file ... when I tried first with int main (void) for customer.cpp, the compiler showed an error saying that "main" was declared as in video. cpp is the same as in customer.cpp, so I tried changing the "main" to "mains", then it dint to show any error ... what did I miss here?