-
2 Attachment(s)
Char searching
Hello, I have a problem with searching chars by diagonal not only the main, i have a chars in vector and I need to go though all posibilities (as shown in picture) the word has to be side/2 long so here i have 9, so word has to be 4 chars long Attachment 13999 how I need to do this? Thanks
-
"How you need to do this" is to figure out how to perform this on paper. Take a look at the development process. Additionally, once you have figured out how to do it without a computer, then you need to write some code and try it for yourself, see our homework policy . Once you have written some code, if you are still stuck then post the smallest, complete program, that shows the problem you are having. To get you started:
Code:
int main()
{
return 0;
}
I will even through in a freebie since you mentioned you had a vector:
Code:
#include <vector>
int main()
{
return 0;
}
-
Code:
void RastiZodiDiag(string & zod, int & kiek, Raides & R, int b,int a,int c, int stulp){
string zodis,ZodisD1,ZodisD2;
int zpab = ceil((double)KiekVietos(Df1)/2)+1;
int stulpe = R.ImtiStulpelius()/2;
//int stulp= R.ImtiStulpelius()/2;
for (int i = a; i < zpab; i++){
if (a!=stulpe+1){
i=a;
for (int j = a+1; j < stulp+1; j++)
{
zodis = R.ImtiRaide(i,j);
ZodisD1+= zodis;
//zodis = R.ImtiRaide(j,i);
//ZodisD2+= zodis;
i++;
}
cout<<ZodisD1<<endl;
if(ZodisD1 == zod || ZodisD2 == zod){
kiek++;
}
ZodisD1="";
ZodisD2="";
/*if(zpab!=R.ImtiEilutes()){
zpab++;
}*/
a++;
i = a;
zpab++;
stulp++;
}
}
c++;
if(b!=stulp){
a=0;
b=c;
RastiZodiDiag(zod,kiek,R,a,b,c,stulp);
}
}
I have written this much, but this only searches for the upper right diagonal from the main diagonal, somehow i need to jump in to another diagonal to right from one i have cherked.