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 45 46 47 48
|
#include <iomanip>
#include <iostream>
using namespace std;
void printArray(int arr[],int len)
{
for(int i = 0; i < len; i++)
{
if (i>0 && i % 10 == 0)
cout<<endl;
cout<<setw(2)<<arr[i]<<" ";
}
cout<<endl;
}
void deleteArray(int original[], int origLen, int newArray[], int index){
for(int i = 0; i < origLen-1; i++){
newArray[i] = original[i];
int index = 0;
}for(int x = 0; x < origLen-1; x++){
newArray[index] = 0;
}
}
void biggerArray(int original[], int origLen, int newArray[], int newLength){
for(int i = 0; i < origLen; i++){
newArray[i] = original[i];
}
}
int main()
{ int intArray[20] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
int smallArray[19] = {};
int bigArray[25] = {};
cout<<"Original array: "<<endl;
printArray(intArray,20);
cout<<endl;
cout<<"Smaller array: "<<endl;
deleteArray(intArray,20,smallArray,5);
printArray(smallArray,19);
cout<<endl;
return 0;
}
|