need help writing this code. It suppose to print 4,2,9,8,12, but i keep getting
ID: 3641019 • Letter: N
Question
need help writing this code. It suppose to print 4,2,9,8,12, but i keep getting errors # include <iostream> # include <vector> using namespace std int main () { int arr[] = {1, 4, 2, 9, 8 , 12} int arrSize = sizeof(arr) /sizeof(int); vector<int> v(arr, arr+ arrSize); f(v); function f(); template <type T > void f (vector<T>& v) { for (i = 0; i < n-l ; i++) v[i] = v[i+1]; v.pop_back(); } need help writing this code. It suppose to print 4,2,9,8,12, but i keep getting errors # include <iostream> # include <vector> using namespace std int main () { int arr[] = {1, 4, 2, 9, 8 , 12} int arrSize = sizeof(arr) /sizeof(int); vector<int> v(arr, arr+ arrSize); f(v); function f(); template <type T > void f (vector<T>& v) { for (i = 0; i < n-l ; i++) v[i] = v[i+1]; v.pop_back(); }Explanation / Answer
hi i edited your code and ran it . i didnt get any error . here is altered code . I hope it helps you . # include # include using namespace std ; int arr[] = {1, 4, 2, 9, 8 , 12}; template void f(T&v) { int i; int n=sizeof(arr) /sizeof(int); for (i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.