#include #include
int main()
{
int input, i;
using namespace std;
vector ankit;
for( i = 0;i <4;i++)
ankit.push_back(cin >> input);
cout << "Output of begin and end: ";
for (auto i = ankit.begin(); i != ankit.end(); ++i)
cout << *i << " "
I dont know about that, but cin takes very little memory space. It is almost equal to null, and just for 1 cin, you will never get a memory limit exceeded if you want to say that. My preferred way is the way @nuttela has shown
cin >> X returns the istream object, so, no. You can however write a function that first reads into a variable then return it’s value as an lvalue. You can then use this function as a template during programming competitions. I have seen @ssjgz doing that, he uses a function read_input or something like that.