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()
- {
- int p=0, k=0;
- string a, ch, res;
- setlocale(LC_ALL, "rus");
- char buff[50];
- ifstream fin("E://qwest.txt");
- cout << ("Введите первое слово словосочитание нажмите <enter> и введите 2ое")<<endl;
- getline(cin, ch);
- getline(cin, a);
- for (int i = 1; i < 10000; i++) {
- fin >> buff;
- if (buff == ch)
- p = i;
- if (buff == a)
- k = i;
- }
- if ((k != 0) && (p != 0) && (p == k - 1)) {
- cout << ch; cout << ' '; cout << a << endl;
- }
- else {
- cout << ("Такого словосочитания нет")<<endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement