[quote=Ancient Dragon;346181]NodeType (line 10) has not been defined so your compiler has no clue what it is.[/quote]

Thanks much! I now realize before I did a forward declaration then wrote the function definition in the implementation file. :)

When I run this code (Visual Studio 2005), I get the following compiler errors and can't fix this no matter what I do:

c:\documents and settings\dthomas006\my documents\visual studio 2005\projects\pa3-q1\pa3-q1\stacktype.h(10) : error C2143: syntax error : missing ';' before '<'

c:\documents and settings\dthomas006\my documents\visual studio 2005\projects\pa3-q1\pa3-q1\stacktype.h(24) : see reference to class template instantiation 'StackType<ItemType>' being compiled

c:\documents and settings\dthomas006\my documents\visual studio 2005\projects\pa3-q1\pa3-q1\stacktype.h(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\documents and settings\dthomas006\my documents\visual studio 2005\projects\pa3-q1\pa3-q1\stacktype.h(10) : error C2238: unexpected token(s) preceding ';'

To me, it sounds like it doesn't like ItemType not being declared but I thought that was the point of using a template. I also attached the file with my main in it. I've looked at other programs I wrote with class templates (this is the first one using stacks) and can't figure out what's wrong. I usually separate the header and implementation files but decided to do it all in one this time. Any suggestions you can give are appreciated. :S

[code=c++]#include <iostream>

include <cstddef>

using namespace std;

template <class ItemType>
class StackType
{
private:
NodeType<ItemType>* topPtr; // It points to a singly-linked list
public:
StackType(); // default constructor: StackType is created and empty
~StackType(); // Destructor: memory for nodes needs to be deallocated
StackType(const StackType<ItemType> &x); // copy constructor: implicitly called for pass
// by value
void MakeEmpty(); // StackType is made empty
bool IsEmpty(); // test if the stack is empty
bool IsFull(); // test if the stack ...

[B]Thank you...thank you!!![/B] I don't know why I can't seem to get it straight on how to pass/declare arrays in a function.

[quote=Aia;334410]remove the & after the last int in the bool Bsearh fuction[/quote]

Aia, I tried that but it didn't help. :sad:

here is the exact text of the bool and brace errors also:

.\pa2-q1.cpp(59) : error C2062: type 'bool' unexpected
.\pa2-q1.cpp(60) : error C2143: syntax error : missing ';' before '{'

Can anyone tell me why I'm getting build errors on the actual function heading and the line under it (**) saying "type bool is unexpected" and that I'm missing a ; before {? I've looked and can't find anything.

Also, I get this error but there is no line 80 and all my braces match up (I think):
pa2-q1.cpp(80) : fatal error C1075: end of file found before the left brace '{' at '.\pa2-q1.cpp(17)' was matched

Any help is appreciated! :confused:

[code=c++]#include <iostream>

include <conio.h>

using namespace std;

const int MAX_ITEMS=10;

bool Bsearch (int , int , int , int, int&);

int main ()
{
int chart[MAX_ITEMS]= {2,6,9,14,23,65,92,96,99,100};
int find, start, end, tms;
tms=0;
bool cont=1;

cout<<"This programs looks for a number in a preset list."<<endl;

do{
    cout<<"Enter a number (no decimals), starting location for search, and ending location "<<
    "(start & end between 0 & "<<MAX_ITEMS-1<<" , inclusive)."<<endl;
    cin>>find>>start>>end;

    if ((start<0||start>MAX_ITEMS-1) ||(end<0||end>MAX_ITEMS-1))
    {
        cout<<"Either the starting or ending location are outside of parameters."<<endl;
        break;
    }
    else if (start>=end)
    {
        cout<<"Starting location must be less than ending location."<<endl;
        break;
    }
    else
    {
        //bool found=0
        if (Bsearch(chart[MAX_ITEMS],find,start,end,tms))
            cout<<"Your number was found in the list after "<<tms<<" passes."<<endl;
        else
            cout<<"Your number was not found in the list after "<<tms<<" passes."<<endl;

        cout<<"Search for another number? Enter 1 for Yes or 0 for No:  ";
        cin>>cont;
    } while (cont);

    _getch();
    return 0;
}

bool Bsearch (int chart[], int find, int start, int end, int& tms)
{
if (start>end)
return false;
else
{
int mid=(start+end)/2; ...