Massive Array list problems:(

Hello, I am working on Array Based Lists and cannot get rid of these errors:( been working on this for over 3 days. Any help woould be greatly apprecaited!
I am new to programming and kind of teaching myself.
arrayListType.cpp
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
#include <string>
#include <iomanip>
#include "arrayListType.h"

bool arrayListType::isEmpty() const
{
     return (length == 0);
}

bool arrayListType::isFull() const
{
     return (length == maxSize);
}

int arrayListType::listSize() const
{
    return length;
}

int arrayListType::maxListSize() const
{
    return maxSize;
}

int arrayListType::print() const
{
    for (int i = 0; i < length; i++)
        cout << list[i] << " ";
    cout << endl;
}

bool arrayListType::isItemAtEqual(int location, int item) const
{
     if (location < 0 || location >= length)
     {
        cout << "The location of the item to be removed "
             << "is out of range." << endl;
        
        return false;
     }
else
    return (list[location] == item);
}

void arrayListType::removeAt(int location)
{
     if (location < 0 || location >= length)
        cout << "The location of the item to be removed "
             << "is out of range." << endl;
     
     else
     {
         for (int i = location; i < length - 1; i++)
             list[i] = list[i+1];
         length--;
     }
}

void arrayListType::RetreiveAt(int location, int& retItem) const
{
     if (location < 0 || location >= length)
        cout << "The location of the item to be retreived is "
             << "out of range" << endl;
     else
        retItem = list[location];
}

void arrayListType::clearList()
{
     length = 0;
}

arrayListType::arrayListType(int size)      
{
     if (size <= 0)
     {
        cout << "The array size must be positive. Creating "
             << "an array of the size 100." << endl;
             
        maxSize = 100;
     }
     else
        maxSize = size;
        
     length = 0;
     
     list = new int{maxSize];
}

arrayListType::~arrayListType()
{
     delete [] list;
}

arrayListType::arrayListType(const arrayListType& otherList)
{
     maxSize = otherList.maxsize;
     length = otherList.length;
     
     list = new int[maxSize];
     
     for (int j = 0; j < length; j++)
         list [j] = otherList.list[j];
}
    

arrayListType.h
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
#ifndef H_arrayListType
#define H_arrayListType

#include <string>
#include <iomanip>


class arrayListType
{
public:
       bool isEmpty() const;
       
       bool isFull() const;
       
       int listSize() const;
       
       int maxListSize() const;
       
       void print() const;
       
       bool isItemAtEqual(int location, int item) const;
       
       virtual void insertAt(int location, int insertItem) = 0;
       
       virtual void insertEnd(int insertItem) = 0;
       
       void removeArt(int location);
       
       void RetreiveAt(int location, int& retItem) const;
       
       virtual void replaceAt(int location, int repItem) = 0;
       
       void clearList();
       
       virtual int seqSearch(int searchItem) const = 0;
       
       virtual void remove(int removeItem) =0;
       
       arrayListType(int size = 100);
       
       arrayListType (const arrayListType& otherList);
       
       virtual ~arrayListType();
       
protected:
          int *list;
          int length;
          int maxSixe;

#endif 

unorderedArrayList.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef H_unorderedArrayListType
#define H_unorderedArrayListType

#include <string>
#include <iomanip>
#include "arrayListType.h"

class unorderedArrayListType: public arrayListType
{
  public:
         void insertAt(int location, int insertItem);
         void insertEnd(int insertItem);
         void replaceAt(int location, int repItem);
         int seqSearch(int searchItem) const;
         void remove(int removeItem);
         
         unorderedArrayListType(int size = 100);
};

#endif 

unorderedArrayList.cpp
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
#include <string>
#include <iomanip>
#include "arrayListType.h"
#include "unorderedArrayListType.h"

void unorderedArrayListType::insertAt(int location, int insertItem)
{
     if (location < 0 || location >=  maxSize)
        cout << "The position of the item to be inserted "
             << "is out of range." << endl;
     else if (length >= maxSize)
        cout << "Cannot insert in a full list" << endl;
     else
     {
         for (int i = length; i > location; i--)
             list[i] = list[i - 1];
         
         list[location] = insertItem;
         
         length++;
     }
}

void unorderedArrayListType::insertEnd(int insertItem)
{
     if (length >= maxSize)
        cout << "Cannot insert in a full list." << endl;
     else
     {
         list[length] = insertItem;
         length++;
     }
}

int unorderedArrayListType::seqSearch(int searchItem) const
{
    int loc;
    bool found = false;
    
    loc = 0;
    
    while (loc < length && !found)
        if (list[loc] == searchItem)
            found = true;
        else
           loc++;
           
    else
        return -1;
}

void unorderedArrayListType::remove(int removeItem)
{
     int loc;
     
     if (length == 0)
         cout << "Cannot delete from an empty list." <<endl;
     else
     {
         loc = seqSearch(removeItem);
         
         if (loc != -1)
             removeAt (loc);
         else
            cout << "The item to be deleted is not in the list."
                 << endl;
     }
}

void unorderedArrayListType::replaceAt(int loaction, int repItem)
{
     if (location < 0 || location >= length)
        cout << "The location of the item to be "
             << "replaced is out of range." << endl;
     else
        list[location] = repItem;
}

unorderedArrayListType::unorderedArrayListType(int size)
                       :arrayListType(size)
{
}

and main.cpp
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
#include <iostream>
#include "unorderedArrayListType.h"

using namespace std;

int main()
{
    unorderedArrayListType intList(25);
    
    int number;
    
    cout << "List 3: Enter 8 integers: ";
    
    for (int count = 0; count < 8; count++)
    {
        cin >> number;
        intList.insertEnd(number);
    }
    
    cout << endl;
    cout << "Line 8: intList: ";
    intList.print();
    cout << endl;
    
    cout << "Line 11: Enter the number to be "
         << "deleted: ";
    cin >> number;
    cout << endl;
    
    intList.remove(number);
    
    cout << "Line 15: after removing " << number
         << " intList: ";
    intList.print();
    cout << endl;
    
    cout << "Line 18: Enter the search item: ";
    
    cin >> number;
    cout << endl;
    
    if (intList.seqSearch(number) != -1)
       cout << "Line 22: " << number
            << " found in intList." << endl;
    else
       cout << "Line 24: " << number
            << " is not in intList." << endl;
            
      return 0;
}

Error codes:

unorderedArrayListType.h:9: error: invalid use of undefined type `class arrayListType'
arrayListType.h:9: error: forward declaration of `class arrayListType'

main.cpp:4: error: expected nested-name-specifier before "namespace"
main.cpp:4: error: expected unqualified-id before "namespace"
main.cpp:4: error: expected `;' before "namespace"
main.cpp:4: error: expected unqualified-id before "namespace"
main.cpp:50: error: expected `}' at end of input
main.cpp: In member function `int arrayListType::main()':
main.cpp:12: error: `cout' undeclared (first use this function)
main.cpp:12: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:16: error: `cin' undeclared (first use this function)
main.cpp:20: error: `endl' undeclared (first use this function)

main.cpp:22: error: 'class arrayListType::unorderedArrayListType' has no member named 'print'
main.cpp:34: error: 'class arrayListType::unorderedArrayListType' has no member named 'print'
main.cpp: At global scope:
main.cpp:50: error: expected unqualified-id at end of input
main.cpp:50: error: expected `,' or `;' at end of input

make.exe: *** [main.o] Error 1
In arrayListType.h you never end the class defintion with };.
ok,
arrayListType.h
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
#ifndef H_arrayListType
#define H_arrayListType

#include <string>
#include <iomanip>


class arrayListType
{
public:
       bool isEmpty() const;
       
       bool isFull() const;
       
       int listSize() const;
       
       int maxListSize() const;
       
       void print() const;
       
       bool isItemAtEqual(int location, int item) const;
       
       virtual void insertAt(int location, int insertItem) = 0;
       
       virtual void insertEnd(int insertItem) = 0;
       
       void removeArt(int location);
       
       void RetreiveAt(int location, int& retItem) const;
       
       virtual void replaceAt(int location, int repItem) = 0;
       
       void clearList();
       
       virtual int seqSearch(int searchItem) const = 0;
       
       virtual void remove(int removeItem) =0;
       
       arrayListType(int size = 100);
       
       arrayListType (const arrayListType& otherList);
       
       virtual ~arrayListType();
       
protected:
          int *list;
          int length;
          int maxSixe;

};
#endif 


Error Codes:

arrayListType.cpp: In member function `bool arrayListType::isFull() const':
arrayListType.cpp:12: error: `maxSize' undeclared (first use this function)
arrayListType.cpp:12: error: (Each undeclared identifier is reported only once for each function it appears in.)

arrayListType.cpp: In member function `int arrayListType::maxListSize() const':
arrayListType.cpp:22: error: `maxSize' undeclared (first use this function)
arrayListType.cpp: At global scope:
arrayListType.cpp:26: error: prototype for `int arrayListType::print() const' does not match any in class `arrayListType'
arrayListType.h:19: error: candidate is: void arrayListType::print() const
arrayListType.cpp:26: error: `int arrayListType::print() const' and `void arrayListType::print() const' cannot be overloaded
arrayListType.cpp: In member function `int arrayListType::print() const':
arrayListType.cpp:28: error: `cout' undeclared (first use this function)
arrayListType.cpp:29: error: `endl' undeclared (first use this function)
arrayListType.cpp: In member function `bool arrayListType::isItemAtEqual(int, int) const':
arrayListType.cpp:36: error: `cout' undeclared (first use this function)
arrayListType.cpp:37: error: `endl' undeclared (first use this function)
arrayListType.cpp: At global scope:
arrayListType.cpp:46: error: no `void arrayListType::removeAt(int)' member function declared in class `arrayListType'
arrayListType.cpp: In member function `void arrayListType::removeAt(int)':
arrayListType.cpp:48: error: `cout' undeclared (first use this function)
arrayListType.cpp:49: error: `endl' undeclared (first use this function)
arrayListType.cpp: In member function `void arrayListType::RetreiveAt(int, int&) const':
arrayListType.cpp:62: error: `cout' undeclared (first use this function)
arrayListType.cpp:63: error: `endl' undeclared (first use this function)
arrayListType.cpp: In constructor `arrayListType::arrayListType(int)':
arrayListType.cpp:77: error: `cout' undeclared (first use this function)
arrayListType.cpp:78: error: `endl' undeclared (first use this function)
arrayListType.cpp:80: error: `maxSize' undeclared (first use this function)
arrayListType.cpp:87: error: expected `;' before '{' token
arrayListType.cpp:90: error: no matching function for call to `arrayListType::arrayListType()'
arrayListType.h:43: note: candidates are: virtual arrayListType::~arrayListType()
arrayListType.cpp:91: error: expected `;' before '{' token
arrayListType.cpp:95: error: cannot allocate an object of type `arrayListType'
arrayListType.cpp:95: error: because the following virtual functions are abstract:
arrayListType.h:37: error: virtual void arrayListType::remove(int)

arrayListType.h:35: error: virtual int arrayListType::seqSearch(int) const
arrayListType.h:31: error: virtual void arrayListType::replaceAt(int, int)
arrayListType.h:25: error: virtual void arrayListType::insertEnd(int)
arrayListType.h:23: error: virtual void arrayListType::insertAt(int, int)
arrayListType.cpp:95: error: expected primary-expression before '(' token
arrayListType.cpp:95: error: expected primary-expression before "const"
arrayListType.cpp:96: error: expected `;' before '{' token
arrayListType.cpp:104: error: expected `}' at end of input

make.exe: *** [arrayListType.o] Error 1

Execution terminated
fixed another small syntax error. now its saying basically everything is undeclared. how is "cout" undeclarable?

arrayListType.h
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
#ifndef H_arrayListType
#define H_arrayListType

#include <string>
#include <iomanip>


class arrayListType
{
public:
       bool isEmpty() const;
       
       bool isFull() const;
       
       int listSize() const;
       
       int maxListSize() const;
       
       void print() const;
       
       bool isItemAtEqual(int location, int item) const;
       
       virtual void insertAt(int location, int insertItem) = 0;
       
       virtual void insertEnd(int insertItem) = 0;
       
       void removeArt(int location);
       
       void RetreiveAt(int location, int& retItem) const;
       
       virtual void replaceAt(int location, int repItem) = 0;
       
       void clearList();
       
       virtual int seqSearch(int searchItem) const = 0;
       
       virtual void remove(int removeItem) =0;
       
       arrayListType(int size = 100);
       
       arrayListType (const arrayListType& otherList);
       
       virtual ~arrayListType();
       
protected:
          int *list;
          int length;
          int maxSize;

};
#endif 


arrayListType.cpp
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
#include <string>
#include <iomanip>
#include "arrayListType.h"

bool arrayListType::isEmpty() const
{
     return (length == 0);
}

bool arrayListType::isFull() const
{
     return (length == maxSize);
}

int arrayListType::listSize() const
{
    return length;
}

int arrayListType::maxListSize() const
{
    return maxSize;
}

void arrayListType::print() const
{
    for (int i = 0; i < length; i++)
        cout << list[i] << " ";
    cout << endl;
}

bool arrayListType::isItemAtEqual(int location, int item) const
{
     if (location < 0 || location >= length)
     {
        cout << "The location of the item to be removed "
             << "is out of range." << endl;
        
        return false;
     }
else
    return (list[location] == item);
}

void arrayListType::removeAt(int location)
{
     if (location < 0 || location >= length)
        cout << "The location of the item to be removed "
             << "is out of range." << endl;
     
     else
     {
         for (int i = location; i < length - 1; i++)
             list[i] = list[i+1];
         length--;
     }
}

void arrayListType::RetreiveAt(int location, int& retItem) const
{
     if (location < 0 || location >= length)
        cout << "The location of the item to be retreived is "
             << "out of range" << endl;
     else
        retItem = list[location];
}

void arrayListType::clearList()
{
     length = 0;
}

arrayListType::arrayListType(int size)      
{
     if (size <= 0)
     {
        cout << "The array size must be positive. Creating "
             << "an array of the size 100." << endl;
             
        maxSize = 100;
     }
     else
        maxSize = size;
        
     length = 0;
     
     list = new int{maxSize];
}

arrayListType::~arrayListType()
{
     delete [] list;
}

arrayListType::arrayListType(const arrayListType& otherList)
{
     maxSize = otherList.maxsize;
     length = otherList.length;
     
     list = new int[maxSize];
     
     for (int j = 0; j < length; j++)
         list [j] = otherList.list[j];
}
    


Errors:

arrayListType.cpp: In member function `void arrayListType::print() const':
arrayListType.cpp:28: error: `cout' undeclared (first use this function)
arrayListType.cpp:28: error: (Each undeclared identifier is reported only once for each function it appears in.)
arrayListType.cpp:29: error: `endl' undeclared (first use this function)

arrayListType.cpp: In member function `bool arrayListType::isItemAtEqual(int, int) const':
arrayListType.cpp:36: error: `cout' undeclared (first use this function)
arrayListType.cpp:37: error: `endl' undeclared (first use this function)

arrayListType.cpp: At global scope:
arrayListType.cpp:46: error: no `void arrayListType::removeAt(int)' member function declared in class `arrayListType'
arrayListType.cpp: In member function `void arrayListType::removeAt(int)':
arrayListType.cpp:48: error: `cout' undeclared (first use this function)
arrayListType.cpp:49: error: `endl' undeclared (first use this function)
arrayListType.cpp: In member function `void arrayListType::RetreiveAt(int, int&) const':
arrayListType.cpp:62: error: `cout' undeclared (first use this function)

arrayListType.cpp:63: error: `endl' undeclared (first use this function)
arrayListType.cpp: In constructor `arrayListType::arrayListType(int)':
arrayListType.cpp:77: error: `cout' undeclared (first use this function)
arrayListType.cpp:78: error: `endl' undeclared (first use this function)
arrayListType.cpp:87: error: expected `;' before '{' token
arrayListType.cpp:90: error: no matching function for call to `arrayListType::arrayListType()'
arrayListType.h:43: note: candidates are: virtual arrayListType::~arrayListType()
arrayListType.cpp:91: error: expected `;' before '{' token
arrayListType.cpp:95: error: cannot allocate an object of type `arrayListType'
arrayListType.cpp:95: error: because the following virtual functions are abstract:
arrayListType.h:37: error: virtual void arrayListType::remove(int)
arrayListType.h:35: error: virtual int arrayListType::seqSearch(int) const
arrayListType.h:31: error: virtual void arrayListType::replaceAt(int, int)
arrayListType.h:25: error: virtual void arrayListType::insertEnd(int)
arrayListType.h:23: error: virtual void arrayListType::insertAt(int, int)
arrayListType.cpp:95: error: expected primary-expression before '(' token
arrayListType.cpp:95: error: expected primary-expression before "const"
arrayListType.cpp:96: error: expected `;' before '{' token
arrayListType.cpp:104: error: expected `}' at end of input

make.exe: *** [arrayListType.o] Error 1

Execution terminated
If you use cout you have to include <iostream>. It is also inside the std namespace. std::cout
Topic archived. No new replies allowed.