Facebook
From mooor, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 183
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string imie, linia;
  9.     bool czyjestimie;
  10.     cout << "Podaj imie ";
  11.     cin >> imie;
  12.  
  13.     ifstream imiona("imiona.txt");
  14.     while (getline(imiona, linia)) {
  15.         if (linia == imie) {
  16.             czyjestimie = true;
  17.             break;}
  18.     }
  19.  
  20.     if (czyjestimie == true){
  21.         cout << "imie istnieje" << endl;
  22.  
  23.     }
  24.     else {cout << "nie istnieje" <<endl;}
  25.  
  26.     return 0;
  27. }
  28.