Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- #include <fstream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "russian");
- fstream kpop2;
- kpop2.open("kpop2.txt", ios::in);
- string s, find;
- char c;
- while (!kpop2.eof()) {
- kpop2.get(c);
- s.push_back(c);
- }
- kpop2.close();
- cout << "Enter word to find: ";
- cin >> find;
- int pos = s.find(find);
- if (pos == -1)
- cout << "Not found" << endl;
- else
- cout << "Word found at " << pos << " position" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement