Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include<iostream>
- #include<fstream>
- using namespace std;
- ifstream fin("in.txt");
- ofstream fout("out.txt");
- void symbol_searching(char a, string s)
- {
- for (int i = 0; i < s.length(); i++)
- {
- if (s[i] == a)
- fout << "Предшествующий символ: " << s[i - 1];
- }
- }
- int main()
- {
- setlocale(0, "");
- char a;
- cout << "Введите символ: " << endl;
- cin >> a;
- while (fin.peek() != EOF)
- {
- string temp;
- fin >> temp;
- symbol_searching(a, temp);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement