0
Help with the code .Does not work properly
Write a program that compares two lines and displays a message about which characters match. #include "stdafx.h" #include <iostream> #include <conio.h> #include <string.h> #define lenght 256 using namespace std; int main() { char str1[lenght], str2[lenght], strnew[lenght]; cout « "Первая строка: "; cin » str1; cout « "Вторая строка: "; cin » str2; int a = strlen(str1); int b = strlen(str2); int k = 0, i = 0; while (i <= a) { for (int j = 0; j <= b; j++) if (str1[i] == str2[j]) { strnew[k] = str1[i]; k++; } i++; } cout « "\n " « strnew « '\n'; }
0 odpowiedzi