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
|
#include <iostream>
#include <ctime>
using namespace std;
void initialize(int list[],int);
void fil (int list[],int);
void print (const int list[],int);
int sum (const int list[],int);
int largest (const int list[],int);
void copyArray(const int list[],int list2[],int);
int main (){
int nums1[10]={0};
int nums2[10];
int size =10;
cout <<"nums elements :" ;
print (nums1,10);
cout<<endl;
initialize(nums2,size);
cout<<"nums elements : ";
print (nums2,size);
cout<<endl<<endl;
cout<<"Enter " <<size<<"integers:";
fil(nums1,size);
cout<<endl;
cout<<"nums1 elements:";
print(nums1,size);
cout<<endl;
cout<<"sum elements of nums1 = "<<sum(nums1,size)<<endl;
cout<<"position of largest element in nums1 ="<<largest(nums1,size)<<endl;
cout<<"Largest element in nums1 = "<<nums1[largest(nums1,size)]<<endl;
cout<<"nums2 elements :";
print(nums2,size);
cout<<endl;
copyArray(nums1,nums2,size);
cout <<"after copy elements of nums2 :";
print (nums2,size);
cout<<endl;
return 0;
}
|