Advertisement
Nikita051

Untitled

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