0

Array of Pointers To Strings C++

I am trying to check string's length in order to check if they have the same number of vowels. But i have to pass an array of pointers to string as parameter. Here is the full code. #include <iostream> #include <string> #include <cstring> using namespace std; bool method(string *A[][5]){ for(int k=0;k<5;k++){ int count=0; int count2=0; for(int i=0;i<5;i++){ for(int j=i+1;j<5;j++){ //SPOSTAMENTO TRA LE STRINGHE for(int g=0;g< strlen(*A[i][k]);g++){ if(A[i][k][g]=='a'||'e'||'i'||'o'||'u'){ count++; } for(int f=0;f<*A[j][k].length();f++){ if(A[j][k][f]=='a'||'e'||'i'||'o'||'u'){ count2++; } } } if(count==count2 && count!=0){cout<<A[i][k]<<A[j][k]<<"this strings are sisters";return true;} } count=0; count2=0; } } }

24th Feb 2020, 4:12 PM
Luca La Rosa
Luca La Rosa - avatar
2 Answers
+ 2
Missing details, <i> and <k> were not introduced, and how the array gets passed to the function is unclear. Giving partial code like that makes it rather hard to assist you. Can you save your code in SoloLearn and share the code link with your question Description? I think it may increase your chances for answers. If you didn't know how, refer to thie following guide 👍 (Edit) Snippet changed, previously it was just a one line of code. https://www.sololearn.com/post/74857/?ref=app
24th Feb 2020, 4:35 PM
Ipang
0
I made a mistake, i'm working with a 3d array. How should I use that inside the method, because it is a matrix of pointers to strings, after i give the parameter as // bool method(string *A[x][y]"// how should i write ? if (*A or if(&A i'm really unable to comprend this...
25th Feb 2020, 5:00 PM
Luca La Rosa
Luca La Rosa - avatar