First Day of College

#include <iostream>
using namespace std;
class vector
{
  private:
  int x,y,z;
  public:
  vector()
  {
    cin>>x>>y>>z;
  }
  vector operator+(vector b)
  {
    vector temp;
    temp.x=x+b.x;
    temp.y=y+b.y;
    temp.z=z+b.z;
    cout<<"Sum="<<temp.x<<"i+"<<temp.y<<"j+"<<temp.z<<"z"<<endl;
  }
};
int main()
{
  vector a,b,c;
  c=a+b;
  return 0;
}

2 comments:

  1. main.cpp: In member function ‘vector vector::operator+(vector)’:
    main.cpp:21:3: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^
    getting this error

    ReplyDelete