Advertisement
Komandor_Astrii

Kolzad1

Jun 23rd, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. vector<string> nowy(vector<string>w, vector<string>n)
  7. {
  8.     vector<string>nowy;
  9.  
  10.     for(unsigned int i = 0; i < w.size(); i++)
  11.     {
  12.         bool znaleziono = false;
  13.         for(unsigned int j = 0; j < n.size(); j++)
  14.         {
  15.             if(w[i].find(n[j])!=string::npos)
  16.                 znaleziono=true;
  17.         }
  18.         if(znaleziono==false)
  19.             nowy.push_back(w[i]);
  20.     }
  21.  
  22.     return nowy;
  23. }
  24.  
  25. int main()
  26. {
  27.     vector<string>w;
  28.     vector<string>n;
  29.     w.push_back("Wiadomosc 1");
  30.     w.push_back("Wiadomosc 2");
  31.     w.push_back("wiadomosc, nie zdasz");
  32.     w.push_back("Message 1");
  33.     w.push_back("Message 2");
  34.  
  35.     n.push_back("nie");
  36.     n.push_back("2");
  37.  
  38.     vector<string>nowyWektor=nowy(w,n);
  39.  
  40.     for(unsigned int i = 0; i < nowyWektor.size(); i++)
  41.     {
  42.         cout<<nowyWektor[i]<<endl;
  43.     }
  44.  
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement