how to input multiple lines of a file in c++

C++
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>

using namespace std;

int main()
{
    
    ifstream in("file.txt");
    stringstream sstr;
    while(in >> sstr.rdbuf());
    cout << sstr.str() << endl;



    return 0;
}

Source

Also in C++: