Advertisement
Guest User

ss

a guest
Oct 8th, 2015
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. bool strcmp(char *str1, char *str2)
  4. {
  5.     bool result=true;
  6.     int i = 0;
  7.     while ((str1[i] != '\0')&&(str2[i] != '\0'))
  8.     {
  9.  
  10.         if (str1[i] != str2[i])
  11.         {
  12.             result=false;
  13.             break;
  14.         }
  15.         else i++;
  16.     }
  17.     return result;
  18. }
  19. void strcopy(char *str1, char *str2)
  20. {
  21.     int i = 0;
  22.     while (str1[i] != '\0')
  23.     {
  24.         str2[i] = str1[i];
  25.         i++;
  26.     }
  27.     cout << "Копирование выполнено\n";
  28. }
  29. int main()
  30. {
  31.     setlocale(LC_ALL, "Russian");
  32.     char *str1[100];
  33.     char *str2[100];
  34.     char *copy[100];
  35.     *str1 = "Ксюша\0";
  36.     *str2 = "программист\0";
  37.     cout<<strcmp(*str1, *str2)<<endl;
  38.     strcopy(*str1, *copy);
  39.  
  40.     system("pause");
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement