Neon_Falcon

Untitled

May 27th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. using namespace std;
  2. #include <iostream>
  3. #include <string>
  4. #include <Windows.h>
  5. const int N = 10;
  6.  
  7. int Contrast(char str1[N], char str2[N])
  8. {
  9. int a = 0, b = 0;
  10. char alf[] = { 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я' };
  11. char ALF[] = { 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я' };
  12. for (int i = 0; i < N; i++)
  13. {
  14. for (int j = 0; j < 33; j++)
  15. {
  16. if (str1[i] == alf[j])
  17. {
  18. a = j;
  19. }
  20. else if (str1[i] == ALF[j])
  21. {
  22. a = j;
  23. }
  24. if (str2[i] == alf[j])
  25. {
  26. b = j;
  27. }
  28. else if (str2[i] == ALF[j])
  29. {
  30. b = j;
  31. }
  32. if (a != b)
  33. {
  34. cout << "Строчки разные!" << endl;
  35. return 0;
  36. }
  37. }
  38. }
  39. cout << "Строчки одинаковые! " << endl;
  40. return 0;
  41.  
  42. }
  43.  
  44. int main()
  45. {
  46. char str1[N], str2[N];
  47. SetConsoleCP(1251);
  48. SetConsoleOutputCP(1251);
  49. cout << "Введите первую строку:";
  50. cin >> str1 ;
  51. cout << "Введите вторую строку:";
  52. cin >> str2 ;
  53. Contrast(str1, str2);
  54. system("pause");
  55. return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment