0
A program that takes an array of length n and sorts it. And because we use a template, the array can be of any type
A program that takes an array of length n and sorts it. And because we use a template, the array can be of any type.......please help..please
13 Respostas
+ 2
زهرا درویشی
The error message says it
"couldn't deduce type parameter 't'"
You are not passing any type parameter to the Arraye() function. You need to do
Arraye<type-of-aray>(n)
There is also no point in having 'n' as an argument to the function
Also, you are clearly not sorting the array you are taking as input.
+ 3
Please directly mail to homeworkdelivery@sololearn.com
They have a free 7/24 service with 10 specialists happy to deliver code within 15 minutes.
+ 3
You didn't seriously sent an email🤨🤨🤨
friend....at least we want to see some effort.
we will help but not do for you.
+ 3
Ohhh🤔
So your last chance is showing own effort.
+ 1
#include <iostream>
using namespace std;
template <class t>
void Arraye(int n)
{
cin>>n;
t b[n];
for(int i=0 ;i<n ;i++)
cin>>b[i];
for (int j=0 ;j<n ;j++)
cout<<b[j];
}
int main()
{
int n;
Arraye(n);
return 0;
}
+ 1
That's all that came to my mind, but it gives an error
+ 1
thanks a lot
+ 1
You can use sort(arr,arr+n), be aware of that it's complexity is O(nlogn).
0
Can you enter the code, please .. please .. I did not find it
0
Believe me, I sent but wrote the email address was not found
0
in main you should specify what kind of array you're using
Arraye<int>(n);
0
زهرا درویشی Hi , hope you are fine 👍🌺 Frogged was actually joking ... there is no email address like that , I think he meant you should put some effort ...