Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include<iostream>
- #include<iomanip>
- #include<string>
- using namespace std;
- class Array
- {
- friend ostream &operator<<(ostream&, const Array &);
- friend istream &operator>>(istream &, Array &);
- public:
- Array();
- Array operator+(const Array&rhs)const;
- private:
- int a1[10];
- };
- Array Array::operator+(const Array&rhs) const
- {
- for (int i = 1; i <= 10; i++)
- {
- }
- }
- Array::Array()
- {
- for (int i = 1; i <= 10; i++)
- {
- a1[i] = 0;
- }
- }
- ostream &operator<<(ostream &output, const Array &a)
- {
- for (int i = 1; i <= 10; i++)
- {
- output << a.a1[i] << ' ';
- }
- return output;
- }
- istream &operator>>(istream &input, Array &a)
- {
- for (int i = 1; i <= 10; i++)
- {
- input >> a.a1[i];
- }
- return input;
- }
- int main()
- {
- Array a, b, sum, diff;
- cout << "Enter data for first array: ";
- cin >> a;
- cout << "Enter data for second array: ";
- cin >> b;
- sum = a + b;
- cout << "First array: " << a << endl << endl;
- cout << "Second array: " << b << endl << endl;
- cout << "Sum: " << sum << endl << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement