Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/140.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 错误原型与类中的任何错误原型都不匹配_C++_Algorithm_Data Structures_Bubble Sort - Fatal编程技术网

C++ 错误原型与类中的任何错误原型都不匹配

C++ 错误原型与类中的任何错误原型都不匹配,c++,algorithm,data-structures,bubble-sort,C++,Algorithm,Data Structures,Bubble Sort,我在NetBeans上运行这个时遇到了一个问题。 以下是我的气泡排序算法课程,包括主要功能: #include <iostream> using namespace std; template <class elemType> class arrayListType { public: void BubbleSort(); private: elemType list[100]; int length; void swap(int f

我在NetBeans上运行这个时遇到了一个问题。 以下是我的气泡排序算法课程,包括主要功能:

#include <iostream>
using namespace std;


template <class elemType>
class arrayListType
{
public:
    void BubbleSort();

private:
    elemType list[100];
    int length;
    void swap(int first, int second);
    void BubbleUp(int startIndex, int endIndex);
    void print();
    void insert();
};

template <class elemType>
void arrayListType<elemType>::BubbleUp(int startIndex, int endIndex)
{

for (int index = startIndex; index < endIndex ; index++){
    if(list[index] > list[index+1])
        swap(index,index+1);
}
} 

template <class elemType>
void arrayListType<elemType>::swap(int first, int second)
{

elemType temp;
temp = list[first];
list[first] = list[second];
list[second] = temp;
} 

template <class elemType>
void arrayListType<elemType>::insert()
{
cout<<"please type in the length: ";
cin>>length;
cout<<"please enter "<<length<<" numbers"<< endl;
for(int i=0; i<length; i++)
{
    cin>>list[i];
}
}

template <class elemType>
void arrayListType<elemType>::print()
{
    cout<<"the sorted numbers" << endl;
    for(int i = 0; i<length; i++)
    {
        cout<<list[i]<<endl;        
    }
}
    int main()
    {
    arrayListType<int> list ;
    list.BubbleSort();

    }
#包括
使用名称空间std;
模板
类arrayListType
{
公众:
void BubbleSort();
私人:
元素类型列表[100];
整数长度;
无效交换(整数第一,整数第二);
void BubbleUp(int startIndex,int endIndex);
作废打印();
无效插入();
};
模板
void arrayListType::BubbleUp(int-startIndex,int-endIndex)
{
对于(int index=startIndex;index列表[索引+1])
互换(指数,指数+1);
}
} 
模板
void arrayListType::swap(int-first,int-second)
{
元素类型温度;
临时=列表[第一];
列表[第一]=列表[第二];
列表[秒]=温度;
} 
模板
void arrayListType::insert()
{
coutlength;
cout错误在这里:

template <class elemType>
void arrayListType<elemType>::BubbleSort(elemType list[], int numvalues)
这不匹配:

BubbleSort(elemType list[], int numvalues)
要解决此错误,请从实际实现中删除参数,或将参数添加到原型中。您的错误是不言自明的,它抱怨原型与定义不匹配

void BubbleSort();
BubbleSort(elemType list[], int numvalues)