一般的なリストを実装しましたが、リスト内の特定の位置からデータを取得しようとしています。 umm ...しかし、私はエラーを取得しています: 'List :: retrieve(int &、Record &)'の呼び出しで一致する関数がありません。 以下は、main.cppのコードとList.hからの関数のスニペットです。 #include完全なコードについてはクラスメンバーに一致する関数呼び出しがありません
MAIN.CPP
#include <iostream>
#include "List.h"
#include "Key.h"
using namespace std;
typedef Key Record;
int main()
{
int n;
int p=3;
List<int> the_list;
Record data;
cout<<"Enter the number of records to be stored. "<<endl;
cin>>n;
for(int i=0;i<n;i=i++)
{
the_list.insert(i,i);
}
cout<<the_list.size();
the_list.retrieve(p, data);
cout<<"Record value: "<<data;
return 0;
}
List.h
Error_code retrieve(int position, List_entry &x)const
{
if(empty()) return underflow;
if(position<0 || position>count) return range_error;
x=entry[position];
return success;
}
:
MAIN.CPP:http://pastebin.com/UrBPzPvi
List.h:私はちょうど基礎を学んでいますし、コードが大規模な再利用可能なモジュールに関してで完璧ではないかもしれないhttp://pastebin.com/7tcbSuQu
P.S。この段階では、機能するだけです。あなたはretrieve
に2番目の引数として渡ししようとしている
おかげ
ummm ...ありがとうございました。どのように私は私の投稿で上記のように使用することができるようにリストの検索機能を変更する必要がありますか? – Cipher
@user:パラメータのタイプを変更するか、 'data'のタイプを変更しますか? –