main.cpp
来自「一个自己定义的数组外包装」· C++ 代码 · 共 35 行
CPP
35 行
#include <algorithm>
#include <functional>
#include "carray.h"
#include "print.h"
using namespace std;
int main()
{
carray<int,10> a;
for(unsigned i=0;i<a.size();++i)
{
a[i]=i+1;
}
PRINT_ELEMENTS(a,"the value of the array is:");
reverse(a.begin(),a.end());
carray<int,10>::const_iterator pos;
for(pos=a.begin();pos!=a.end();++pos)
{
cout<<*pos<<" ";
}
cout<<endl;
transform(a.begin(),a.end(),
a.begin(),
negate<int> ());
PRINT_ELEMENTS(a);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?