HOW TO TAKE INPUT TILL NEWLINE



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



Comments

Popular posts from this blog

HOW TO USE DOCKER

Flutter Native Application Development

REVERSE ARRAY COCUBES