array1d.cpp

来自「data structures, algorithms and Applicat」· C++ 代码 · 共 26 行

CPP
26
字号

// test 1D array class

#include <iostream.h>
#include "array1d.h"

void main(void)
{
   try {
      Array1D<int> X(10), Y, Z;
      for (int i=0; i < 10; i++)
         X[i] = i;
      cout << "X[3] = " << X[3] << endl;
      cout << "X is " << X << endl;
      Y = X;
      cout << "Y is " << Y << endl;
      X += 2;
      cout << "X incremented by 2 is " << X << endl;
      Z = (Y + X) * Y;
      cout << "(Y + X) * Y is " << Z << endl;
      cout << "-(Y + X) * Y is " << -Z << endl;
      }
   catch (...) {
      cerr << "An exception has occurred" << endl;}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?