Advertisement
Nikita051

Untitled

Jun 14th, 2023
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <vector>
  4. #include <string>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     vector<string> str;
  10.     ifstream file("file.txt");
  11.  
  12.     int i = 0;
  13.     string buffer;
  14.     while (getline(file, buffer, ' ')) {
  15.         str.push_back(buffer);
  16.         i++;
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement