Compare to the element line.

Given two words. For each letter of the first word (including repeated letters in the word) to determine whether it is on the second floor.

Solved without the use of functions to work with C-strings.

I only found the letters which should be "yes," how to do that and "no" in her place?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <windows.h>
#include <cstring>

using namespace std;

int main(){
	SetConsoleCP(1251);
	SetConsoleOutputCP(1251);
	char word1[100], word2[100];
	char *ph;

	cout << "Введите первое слово: ";
	gets_s(word1);
	
	cout << "Введите второе слово: ";
	gets_s(word2);

	int size = strlen(word1);
	int size2 = strlen(word2);

	ph = strpbrk(word1, word2);

	cout << "s = " << size << endl;

	while(ph != NULL){
		cout << "да ";
		cout << " " << *ph;
		ph = strpbrk (ph + 1, word2);
	}

	cout << endl;

	system("pause");
	return 0;
}
Last edited on
Topic archived. No new replies allowed.