i want to know when we take the input using cin then what does '\n' and ' ' does.

#include <iostream>
#include <string>

using namespace std;

int main()
{
    int x, y;
    string s;
    double a, b;
    cin >> x;
    cin >> y;
    cin >> s;
    cin >> a;
    cout << x << " " << y << " " << s << " " << a << endl;
    return 0;
}

is'nt this code is expected to end if i enter consicutive 4 time '\n'

cin waits till the user inserts something into the stream, and after that it takes into consideration the '\n'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.