Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include "string"
  4. #include <fstream>
  5. using namespace std;
  6.  
  7.  
  8. int main()
  9. {
  10. int p=0, k=0;
  11. string a, ch, res;
  12. setlocale(LC_ALL, "rus");
  13. char buff[50];
  14. ifstream fin("E://qwest.txt");
  15. cout << ("Введите первое слово словосочитание нажмите <enter> и введите 2ое")<<endl;
  16. getline(cin, ch);
  17. getline(cin, a);
  18. for (int i = 1; i < 10000; i++) {
  19. fin >> buff;
  20. if (buff == ch)
  21. p = i;
  22. if (buff == a)
  23. k = i;
  24.  
  25. }
  26. if ((k != 0) && (p != 0) && (p == k - 1)) {
  27. cout << ch; cout << ' '; cout << a << endl;
  28. }
  29. else {
  30. cout << ("Такого словосочитания нет")<<endl;
  31. }
  32. system("pause");
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement