// SPECIFICATION FILE (sList.h) 
// This file gives the specification of a sorted ADT 
// The list components are maintained in ascending order of value 
//****************************************************************** 
#ifndef SLIST_H 
#define SLIST_H 
const int MAX_LENGTH = 50;// Maximum possible number of components needed
typedef int ItemType; // Type of each component

class SortedList { 
public: 
    SortedList(); 
    bool IsEmpty() const; 
    bool IsFull() const; 
    void MakeEmpty(); 
    int Length() const; 
    void Insert(ItemType item); 
    void Delete(ItemType item); 
    bool IsPresent(ItemType item) const; 
    void Print() const; 
	void Mergelist();
 private: 
    int      length; 
    ItemType data[MAX_LENGTH]; 
    void     BinSearch(ItemType item, bool& found, int& position) const; 
}; 
#endif

// IMPLEMENTATION FILE (sList.cpp) 
// This file implements the SortedList class member functions 
// List representation: a one-dimensional array and a length 
// Private members of class: 
//    int      length; 
//    ItemType data[MAX_LENGTH]; 
//    void     BinSearch( ItemType, bool&, int& ) const; 
//****************************************************************** 
#include "sList.h" 
#include <iostream> 
#include<fstream>
#include<cstdlib>
#include<iomanip>
using namespace std;

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

bool SortedList::IsEmpty() const { 
    return (length == 0); 
}

bool SortedList::IsFull() const { 
    return (length == MAX_LENGTH); 
}

void SortedList::MakeEmpty(){ 
    length = 0; 
}

int SortedList::Length() const { 
    return length; 
}

void SortedList::Insert(ItemType item) { 
    int index; 
    index = length - 1; 
    while (index >= 0 && item < data[index]) { 
        data[index+1] = data[index]; 
        index--; 
    } 
    data[index+1] = item;  // Insert item 
    length++; 
}

void SortedList::BinSearch(ItemType item, bool& found, int& position ) const { 
    int first = 0; 
    int last = length - 1; 
    int middle; 
    found = false; 
    while (last >= first && !found) { 
        middle = (first + last) / 2; 
        if (item < data[middle]) 
            last = middle - 1; 
        else if (item > data[middle]) 
            first = middle + 1; 
        else 
            found = true; 
    } 
    if (found) 
        position = middle; 
}

void SortedList::Delete(ItemType item ) { 
    bool found;      // True if item is found 
    int position;    // Position of item, if found 
    int index; 
    BinSearch(item, found, position); 
    if (found) { 
     // Shift data[position..length-1] up one position 
        for (index = position; index < length - 1; index++) 
            data[index] = data[index+1]; 
        length--; 
    } 
}

bool SortedList::IsPresent(ItemType item ) const { 
    bool found;      // True if item is found 
    int position;    // Used in the call to BinSearch 
    BinSearch(item, found, position); 
    return found; 
}

void SortedList::Print() const { 
    for (int index = 0; index < length; index++) 
        cout << data[index] << "  "; 
}
void SortedList::Mergelist()
{
}
#include "sList.h"
#include<iostream>
#include<fstream>
#include<cstdlib>
#include<iomanip>
#include<string>
using namespace std;

void input_list1(ifstream& input);
void get_input(SortedList& , ifstream&  );


int main()
{
	SortedList list_1;
	SortedList list_2;
	ifstream next;
	input_list1(next);
	get_input(list_1,next);
	
	 
return 0;
}

void input_list1(ifstream& in_stream)
{
	string filename1;
	cout<< "Input file name:";
	cin>>filename1;
	in_stream.open("c:\\Program Files\\list1.txt");
	if(in_stream.fail())
	{
		cout<< "cannot open file"<<endl;
		exit(1);
	}
}
void get_input1(SortedList& list_1,  ifstream& list1 )
{
int number;
list1>>number;
cout<<number;
while(number)
{
	list_1.Insert(number);
	list1>>number;
}
}

my problem is when i compile it up to this point i get this error message:sListclient.obj : error LNK2019: unresolved external symbol "void __cdecl get_input(class SortedList &,class std::basic_ifstream<char,struct std::char_traits<char> > &)" (?get_input@@YAXAAVSortedList@@AAV?$basic_ifstream@DU?$char_traits@D@std@@@std@@@Z) referenced in function _main

and:
C:\Documents and Settings\Krystian\My Documents\Visual Studio 2005\Projects\SLIST_H\Debug\SLIST_H.exe : fatal error LNK1120: 1 unresolved externals

what am I doing wrong?
thank you for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.