Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- void print(int x[10],int n);
- void rprint(int x[10],int n);
- void marray(int x[10],int n);
- void mrarray(int x[10],int n);
- int main()
- {
- int a[10];
- int i;
- int n;
- cout<<"how many array elements? n=";
- cin>>n;
- cout<<"enter data :"<<endl;
- for(i=0;i<n;i++)
- {
- cout<<"a["<<i<<"]=";
- cin>>a[i];
- }
- print(a,n);
- rprint(a,n);
- marray(a,n);
- mrarray(a,n);
- return 0;
- }
- void marray(int x[10],int n)
- {
- int i;
- cout<<" array multiplied by 3 ,then contents are :"<<endl;
- for(i=0;i<n;i++)
- {
- cout<<"x["<<i<<"]="<<x[i]*3<<endl;
- }
- }
- void print(int x[10],int n)
- {
- int i;
- cout<<" array contents are :"<<endl;
- for(i=0;i<n;i++)
- {
- cout<<"x["<<i<<"]="<<x[i]<<endl;
- }
- }
- void rprint(int x[10],int n)
- {
- int i;
- cout<<"reversing the array elements"<<endl;
- for(i=n-1;i>=0;i--)
- {
- cout<<"x["<<i<<"]="<<x[i]<<endl;
- }
- }
- void mrarray(int x[10],int n)
- {
- int i;
- cout<<"reversing of multiplied array elements"<<endl;
- for(i=n-1;i>=0;i--)
- {
- cout<<"x["<<i<<"]="<<x[i]*3<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement