Hello OrseskO,
You are not wasting my time except for not posting the input file that I have asked for. What you are using and what I have created may work differently there for any suggestions I have may not work or do you any good.
With my initial testing I have opened the switch and case statements for 1, 3 and 7 ant they all appear to work for now.
At the beginning of your program you have this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
struct node
{
int info;
struct node *next;
struct node *prev;
}*start, *last; // <--- These two variables are set to "NULL" because they are global variables.
int counter = 0; // <--- Should not be a global variable.
class double_clist
{
public:
node *create_node(int);
void insert_last();
void delete_pos();
void search();
void display();
void reverse();
double_clist() // <--- Redundant as the variables are already initialized.
{
start = NULL;
last = NULL;
}
};
| |
In line 6 the two variables, what most call "head" (kafa) and tail (kuyruk) are initialized when the program compiles because they are global variables. This could also be
implementation dependent as a different compiler and set of header files may treat this differently.
When it comes to the default ctor and dtor just let the compiler take care of this.
In "main you define
bool flag = true;
, but never use it in "main". Did you have a reason for this?
The "insert_last()" function works, but the code gives me the feeling that it is not what it should be. I still have to look into this more.
The "display()" function works, but I think the ("<->") part is more than you need. A simple (", ") would work and be easier to read.
Andy