Advertisement
ZhilinskiyG

Sravnenie chisel

Apr 9th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4. int lenght(char str[])
  5. {
  6.     int z=0;
  7.     while (str[z] != '\0'){
  8.         z++;
  9.     }
  10.     return z;
  11. }
  12. bool compear(char str1[], char str2[]){
  13.     int l1 = lenght(str1);
  14.     int l2 = lenght(str2);
  15.     if (l1 != l2){
  16.         return false;
  17.     }
  18.    
  19.     int d = 0;
  20.     while (d < l1){
  21.         if ( str1[d] != str2[d]){
  22.             return false;
  23.         }
  24.         d++;
  25.     }
  26.     return true;
  27.    
  28. }
  29. int _tmain(int argc, _TCHAR* argv[])
  30. {
  31.     char str[200], str1[200];
  32.     cin.getline(str,200);
  33.     cin.getline(str1, 200);
  34.     cout << compear(str, str1);
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement