Program compiles OK but bombs out when running it

The skeleton of the program in from the bo0k by DS Malik.
Three functions were not defined there and I defined there and I defined them myself viz:
int search(int searchItem);
void remove(int removeItem);
void destroy();

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
 #include<iostream>
using namespace std;

class intListType
{
public:
    bool isEmpty();
    //Function to determine whether the list is empty.
    //PRecondidition: The list must exist.
    //Postcondition: REturns true if the list is empty,
    //               false otherwise

    bool isFull();
    //Function to determine whether the list is full.
    //Precondiion: The list must exist
    //Postcondition: Returns true if the list is full,
    //                 false otherwise

    int search(int searchItem);
    // Function to determine whether searchItem is in the list,
    // Postcondition: If searchItem is in the list,
    //                returns its index, that is,
    //                its position in the list;
    //                 otherwise , it returns -1.

    void insert(int newItem);
    //Function to insert newItem in the list.
    //Precondiion: The list must exist and must not be full
    //Postcondition: newItem is inserted in the list and
    //              the length is incremented by one.

    void remove(int removeItem);
    //Function to delete removeItem from the list.
    //Precondiotn: The list must exist and must not be empty
    //Postcondition: If found, removeItem is deleted
    //               from the list and the length is
    //               decremented by one. otherwise,
    //               an appropriate message is printed.

    void destroy();
    //Function to remove all the elements of the list.
    // Precondition: The list must exist.
    //Postcodition: The length is set to 0

    void printList();
    // Function to output the elements of the list.
    //Precondition: The list must exist
    //Postcondition: The elements of the list are
    //              printed on the standard output device

    intListType();
    //default constructor
    //Postcondition: length = 0

private:
    int list[1000];
    int length;
};

bool intListType::isEmpty()
{
    return (length == 0);
}
bool intListType::isFull()
{
    return (length == 1000);
}
int intListType::search(int searchItem)
{
    int location = 0;
    bool found = false;
    int number_used;
    while((!found) && location < number_used)
        if(searchItem == location)
            found = true;
        else
            location++;
        if(found)
            return location;
        else
            return -1;
}
void intListType::insert(int newItem)
{
    list[length] = newItem;
    length++;
    }
void intListType::remove(int removeItem)
{
    list[length] = removeItem;
    length--;
}
void intListType::destroy()
{
    //delete [] list;
    length = 0;
}
void intListType::printList()
{
    //int newItem;
    //cout << list[newItem];
    for(int i = 0; i < length; i++) {
			cout << list[i] << endl;
}
}

intListType::intListType()
{
    length == 0;
}

int main()
{
    int newItem ;
    intListType list1;
    list1.insert(54);
    list1.insert(544);
    list1.printList();

    return 0;
}
The program bombs out when I run it

Help me as to why it does not run
Have a close look at line 109
length == 0;

I don't think you meant to use a LOGICAL operator == there.
Thank you very much lastchance!!!!
It worked very well after changing that line to:
 
length = 0;

Topic archived. No new replies allowed.