**this is the code and it keeps giving me a red line under (z=v2*v1),,please help me finding the mistake :( :(
thanks ^_^
#pragma once
using std::cout;
using std::cin;
using std::ostream;
using std::istream;
class vector{
public:
friend ostream& operator<< (ostream&,vector&);
friend istream& operator>> (istream&,vector&);
friend vector operator*(vector &,vector &);
vector(void);
vector(int);
~vector(void);
private:
int *my_vector;
int n;
};
#include<iostream>
#include "vector.h"
using namespace std ;
vector::vector(){
n=2;
my_vector=new int[n];
}
vector::vector(int n1) {
n=n1;
my_vector=new int[n];
}
vector::~vector(){}
istream& operator>>(istream& in,vector& v){
cout<<"please enter the values of the vector"<<endl;
for(int i=0;i<(v.n);i++){
in>>v.my_vector[i];
}
return in;
}
ostream& operator<<(ostream& out,vector& v ){
for (int j = 0; j <(v.n); j++){
out<<" "<<v.my_vector[j];
}
return out;
}
vector operator*(vector &v,vector &v1){
double z;
cin>>z;
for(int m=0;m<v.n;m++){
z=v.my_vector[m]*v1.my_vector[m];
}
return z;
}
#include<iostream>
#include "vector.h"
using namespace std ;
int main (){
vector v1(3);
vector v2(3),v3(3);
double z;
cin>>v1;
cin>>v2;
z=v2*v1;
cout<<"V1 :"<<v1<<endl;
cout<<"V2 :"<<v2<<endl;
cout<<"The addition :"<<v3<<" "<<"v1 :"<<v1<<endl;
getchar();
getchar();
return 0;
}