Answer the question
In order to leave comments, you need to log in
I don't understand where is the type incompatibility?
Hello, tell me what I'm doing wrong
[Error] invalid conversion from 'int' to 'int*' [-fpermissive]
template<typename T3,typename T4>
void Bubble(T3 N, T4 *mass[]){
bool swap;
do {
swap=false;
for (int i=0;i<N-1;i++){
if (mass[i]<mass[i+1]){
swap=true;
cout<<mass[i];
T3 temp = mass[i];
mass[i]=mass[i+1];
mass[i+1]=temp;
}
}
} while (swap);
for ( int i =N-1;i>=0;i--){
cout<<mass[i]<<"\n";
}
}
int main(){
int n;
int m;
cin>>n;
int *mass = new int [n];
for(int i=0;i<n;i++){
cin>>m;
mass[i]=m;
}
Bubble(n, &mass);
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question