Vector Addition

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Vector Addition as PDF for free.

More details

  • Words: 80
  • Pages: 1
#include #include const int size=10; class vector { private: int *array; public: void *operator new(size_t size) { vector *myvector; myvector=::new vector; return myvector; } void operator delete(void *vec) { vector *myvector; myvector=(vector *)vec; delete(int *)myvector->array; :: delete vec; } void read() { for(int i=0;i<size;i++) { cout<<"vector["<<<"]"; cin>>array[i]; }

} int sum() { int sum; for(int i=0;i<size;i++) sum+=array[i]; } };

void main() { vector *myvector=new vector; clrscr(); cout<<"Enter vector data : "<<endl; myvector->read(); cout<<"sum of vector : "<<myvector->sum(); delete myvector; }

Related Documents

Vector Addition
June 2020 19
Addition
November 2019 31
Addition
October 2019 41
Vector
October 2019 38