I am having trouble making a vector that would return the original elements of a vector squared.
This is the error I am getting.
no operator "<<" matches these operands -- operand types are: std::ostream << std::vector<int, std::allocator<int>>
#include <iostream>
#include <vector>
#include <cmath>
void squareRoot(std::vector<int> &v){
int x;
std::vector<int> squared;
for(auto i:v){
int x = i*i;
squared.push_back(x);
}
std::cout << squared << std::endl; //error occurs at this line
return;
}
int main(){
std::vector<int> v = {2,4,8,1};
squareRoot(v);
return 0;
}