I think it's not working, but is it possible to do something like that to avoid that hard typing?
Code:char c; if( c == ('ą' || 'č'||'Ą'||'Č'||'ę'||'Ę'||'ė'||'Ė'||'į'||'Į'||'š'||'Š'||'ų'||'Ų'||'ū'||'Ū'||'ž'||'Ž') ) { //do stuff }
I think it's not working, but is it possible to do something like that to avoid that hard typing?
Code:char c; if( c == ('ą' || 'č'||'Ą'||'Č'||'ę'||'Ę'||'ė'||'Ė'||'į'||'Į'||'š'||'Š'||'ų'||'Ų'||'ū'||'Ū'||'ž'||'Ž') ) { //do stuff }
Try this:
Code:char c ; ... std::string s = "ąčĄ"; //etc ... if (s.find(c) != std::string::npos) { ... }
This does not work, because the code to the right of the == is run first. C++ doesn't have a "shorthand" for comparing. To do what you want in the same fasion you'd have to domanasij7479's solution is the correct way.Code:if(c == 'ą' || c == 'č' || c == 'Ą' || etc...
This does not work, because the code to the right of the == is run first. C++ doesn't have a "shorthand" for comparing. To do what you want in the same fasion you'd have to domanasij7479's solution is the correct way.Code:if(c == 'ą' || c == 'č' || c == 'Ą' || etc...