REVERSE ARRAY COCUBES

#include<bits/stdc++.h>
using namespace std;
void swap(int *a,int *b)
{
int *temp;
temp=a;
a=b;
b=temp;
}
int main()
{
 string line;
 int i=0,r,len;
 vector<int> a;
 getline(cin,line);
 istringstream iss(line);
 while(iss>>r)
 {
  a.push_back(r);
 }
 len=a.size();
 for(i=0;i<len/2;i++)
 {
  swap(a[i],a[len-i-1]);
 }
 for(i=0;i<len;i++)
  cout<<a[i]<<" ";
 return 0;
}


Comments

Popular posts from this blog

HOW TO USE DOCKER

Flutter Native Application Development

SINGLE LOOP SORTING TECHNIQUE