Create a text file in which to write 3 sentences. Read and display its contents on the screen.

Create a text file in which to write 3 sentences. Read and display its contents on the screen. Determine the length of each sentence.

Before starting, create a file named textFileForTheTask, where write the lines

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main () {
setlocale (LC_ALL, “Russian”);
ifstream myfile;
string s1;
string s2;
string s3;
myfile.open (“textFileForTheTask.txt”);
cout << “Reading from file” << endl;
myfile >> s1 >> s2 >> s3;
myfile.close ();
cout << “File content:” << endl;
cout << s1 << endl << s2 << endl << s3 << endl;
cout << “String length” << s1 << ” << s1.size () << endl;
cout << “String length” << s2 << ” << s2.size () << endl;
cout << “String length” << s3 << ” << s3.size () << endl;

return 0;
}



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.