-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02.cpp
More file actions
44 lines (44 loc) · 1.16 KB
/
02.cpp
File metadata and controls
44 lines (44 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "Vectory.hpp"
#include <iostream>
using namespace std;
void print(int len ,Vectory<int> & arr)
{
for(int i=len;i>=0;i--)
{
cout<<"Arr["<<i<<"] is : "<<arr[i]<< " the len is :"<<arr.getLen()<<"the capacity is "<< arr.getCapacity()<<endl;
arr.popBack();
if(arr.isEmpty())
{
cout<<"Arr is empty"<<endl;
}
}
}
int main()
{
Vectory<int> arr;
for(int i=1;i<=10;i++)
{
arr.pushBack(short(i+'A'-1));
cout<<"len is : " << arr.getLen() << " capacity is : "<< arr.getCapacity() << endl;
}
Vectory<int> arr1(arr);
//print(arr.getLen(),arr);
for(int i=9;i>=0;i--)
{
cout<<"Arr["<<i<<"] is : "<<arr[i]<< " the len is :"<<arr.getLen()<<"the capacity is "<< arr.getCapacity()<<endl;
arr.popBack();
if(arr.isEmpty())
{
cout<<"Arr is empty"<<endl;
}
}
for(int i=9;i>=0;i--)
{
cout<<"Arr["<<i<<"] is : "<<arr1[i]<< " the len is :"<<arr1.getLen()<<"the capacity is "<< arr1.getCapacity()<<endl;
arr1.popBack();
if(arr1.isEmpty())
{
cout<<"Arr is empty"<<endl;
}
}
}