vector.cpp
来自「一本全面剖析C++数据结构算法的书籍」· C++ 代码 · 共 24 行
CPP
24 行
#include<iostream.h>#include "vector.h"void main(void){try { Vector<int> X(10), Y, Z; for (int i=1; 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 + -
显示快捷键?