Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <string.h>
- using namespace std;
- int main ()
- {
- int counter=1, found = 0, i = 0;
- cout << "Iveskite simbolius:";
- std::string str, str2="";
- std::getline(std::cin, str);
- unsigned a = str.find (' ',0);
- while(str[i] != char(32)) {
- str2+=str[i];
- i++;
- }
- cout<< "Pirmas zodis:";
- cout<<str2<<endl;
- found = str.find(str2, found+1);
- while(found!=std::string::npos)
- {
- counter++;
- found = str.find(str2, found+1);
- }
- cout<< "Pasikartojo zodziu eiltueje: "<< counter << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement