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

25th May 2021, 9:10 AM
‎زهرا درویشی‎
‎زهرا درویشی‎ - avatar
13 odpowiedzi
+ 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.
25th May 2021, 1:34 PM
XXX
XXX - avatar
+ 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.
25th May 2021, 11:06 AM
Oma Falk
Oma Falk - avatar
+ 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.
25th May 2021, 11:42 AM
Oma Falk
Oma Falk - avatar
+ 3
Ohhh🤔 So your last chance is showing own effort.
25th May 2021, 11:45 AM
Oma Falk
Oma Falk - avatar
+ 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; }
25th May 2021, 11:56 AM
‎زهرا درویشی‎
‎زهرا درویشی‎ - avatar
+ 1
That's all that came to my mind, but it gives an error
25th May 2021, 11:57 AM
‎زهرا درویشی‎
‎زهرا درویشی‎ - avatar
+ 1
thanks a lot
25th May 2021, 3:56 PM
‎زهرا درویشی‎
‎زهرا درویشی‎ - avatar
+ 1
You can use sort(arr,arr+n), be aware of that it's complexity is O(nlogn).
26th May 2021, 5:19 PM
Vishal Pandey
0
Can you enter the code, please .. please .. I did not find it
25th May 2021, 11:40 AM
‎زهرا درویشی‎
‎زهرا درویشی‎ - avatar
0
Believe me, I sent but wrote the email address was not found
25th May 2021, 11:44 AM
‎زهرا درویشی‎
‎زهرا درویشی‎ - avatar
0
in main you should specify what kind of array you're using Arraye<int>(n);
26th May 2021, 12:24 AM
Alpha Zero
Alpha Zero - avatar
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 ...
27th May 2021, 4:30 AM
Ali_combination
Ali_combination - avatar