Advertisement
Pafnytiu

доделать файл 2 -19

May 10th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <string>
  2. #include<iostream>
  3. #include<fstream>
  4. using namespace std;
  5. ifstream fin("in.txt");
  6. ofstream fout("out.txt");
  7. void symbol_searching(char a, string s)
  8. {
  9. for (int i = 0; i < s.length(); i++)
  10. {
  11. if (s[i] == a)
  12. fout << "Предшествующий символ: " << s[i - 1];
  13. }
  14.  
  15. }
  16.  
  17. int main()
  18. {
  19. setlocale(0, "");
  20. char a;
  21. cout << "Введите символ: " << endl;
  22. cin >> a;
  23. while (fin.peek() != EOF)
  24. {
  25. string temp;
  26. fin >> temp;
  27. symbol_searching(a, temp);
  28.  
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement