Advertisement
mostlabs

15/2

May 18th, 2020
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.    
  11.     int a , b , c;
  12.     cout << "a:";
  13.     cin >> a;
  14.     cout << "b:";
  15.     cin >> b;
  16.     cout << "c:";
  17.     cin >> c;
  18.  
  19.    
  20.     int i = 0;
  21.     string text, word;
  22.  
  23.     ifstream al("tek.txt",ios::binary);
  24.     while (getline(al,text)) {
  25.        
  26.         ++i;
  27.        
  28.         if (i == c) {
  29.  
  30.  
  31.             string str2 = text.substr(a, b);
  32.             cout << str2;
  33.         }
  34.         if (text.size() < c) {
  35.  
  36.             cout << "a";
  37.        }
  38.      
  39.        
  40.        
  41.      }
  42.  
  43.     if (c > i) {
  44.         cout << "sütün bulunamadı";
  45.  
  46.     }
  47.    
  48.    
  49.  
  50.    
  51.  
  52.     al.close();
  53.     return 0;
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement