How to read multiple line in c++

#include <iostream>

using namespace std;

int main()
{

    string s;
    string ml;
    cout<< "Enter the input line" << endl;
    
    while (getline(cin, s))
            ml +=" "+ s;
    cout<< ml<< endl;

    return 0;

}

No comments

Theme images by enjoynz. Powered by Blogger.