home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
OTHERUTI
/
TCPP30-3.ZIP
/
EXAMPLES.ZIP
/
LIST.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-18
|
727b
|
35 lines
// Borland C++ - (C) Copyright 1991 by Borland International
// list.cpp: Implementation of the List Class
// from Hands-on C++
#include <iostream.h>
#include "list.h"
int List::put_elem(int elem, int pos)
{
if (0 <= pos && pos < nmax)
{
list[pos] = elem; // Put an element into the list
return 0;
}
else
return -1; // Non-zero means error
}
int List::get_elem(int& elem, int pos)
{
if (0 <= pos && pos < nmax)
{
elem = list[pos]; // Retrieve a list element
return 0;
}
else
return -1; // non-zero means error
}
void List::print()
{
for (int i = 0; i < nelem; ++i)
cout << list[i] << "\n";
}