Advertisement
minilose

Untitled

Jun 13th, 2022
1,078
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1.     for (int i = 0; i < count; i++)
  2.     {
  3.         char* input1 = new (std::nothrow) char[20];
  4.         char* input2 = new (std::nothrow) char[20];
  5.         std::cin >> input1 >> input2;
  6.         dictionary[i][0] = input1;
  7.         dictionary[i][1] = input2;
  8.     }
  9. =================================================================
  10. char check;
  11.     char inputStr[100];
  12.     char* p;
  13.    
  14.     do
  15.     {
  16.         std::cout << "String: ";
  17.         getchar();
  18.         std::cin.getline(inputStr, 100);
  19.  
  20.         p = replaceFromDictionary(inputStr, dictionary, count);
  21.  
  22.         std::cout << inputStr << " (" << strlen(inputStr) << ")-> " << p << "(" << strlen(p) << ")" << std::endl;
  23.         delete[] p;
  24.        
  25.         std::cout << "Continue? [y/n]";
  26.         std::cin >> check;
  27.         system("cls");
  28.     } while (check == 'y');
  29.  
  30.     for (int i = 0; i < count; i++)
  31.     {
  32.         delete[] dictionary[i][0];
  33.         delete[] dictionary[i][1];
  34.     }
  35.  
  36.     delete[] dictionary;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement