Advertisement
Kolyach

Файлы 31

Dec 16th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <fstream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. bool check = true;
  9.  
  10. int main()
  11. {
  12.     setlocale(LC_ALL, "russian");
  13.     string *arr = new string[100];
  14.     char ch=0;
  15.     string inf;
  16.     int n = 0;
  17.     fstream kpop;
  18.     kpop.open("kpop.txt", ios::in);
  19.     while (!kpop.eof())
  20.     {
  21.         getline(kpop, inf, ' ');
  22.         cout << inf << " ";
  23.         for (int i = 0; i < inf.length(); i++) {
  24.             ch=inf[i];
  25.             if (((ch >= ' ')&&(ch <= '@')) || ((ch >= '0')&&(ch <= '9'))) {
  26.                 check = false;
  27.                 break;
  28.             }
  29.             else check = true;
  30.         }
  31.         if (check == true) {
  32.             arr[n] = inf;
  33.             n++;
  34.         }
  35.     }
  36.     kpop.close();
  37.     if (n < 3) cout << endl << arr[0] << endl;
  38.     else
  39.     cout << endl << arr[n - 3] << endl;
  40.     system("pause");
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement