C
C
ccc352015-10-03 18:40:25
Arrays
ccc35, 2015-10-03 18:40:25

How to return DMU on copies of string fragments?

void func(char *str){
  char *outStr = new char[256];
  for(int i = 3; i < strlen(str)-3; i++){
    int j = 1;
    while(str[i-j] == str[i+j])
      j++;
    if(str[i-j] != str[i+j]){
      cout << "\n";
    }
    if(j > 3){
      for(int k = i-j+1; k < i+j; k++){
        cout << str[k];
      }
     }	
  }
}
int main(){
  SetConsoleCP(1251);
  SetConsoleOutputCP(1251);
  char str[256];
  cout << "Введите строку \n"; 
  cin.getline(str,256);
  func(str);
  getchar();
}

The function searches the string for symmetry.
How to return a dynamic array of pointers to copies of found fragments?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question