+ 3

How can i check if a sentence is in palindrome or not in c++?

14th Oct 2017, 1:40 AM
Shantanu Kundu
Shantanu Kundu - avatar
3 Réponses
+ 10
Or you can simply write the reversed version of the string to a temporary variable and compare for equality with the original one.
14th Oct 2017, 5:05 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
i have a question mayself: if you have some sword of double data or float,at some point a 161.0 is not 161(corect me if im wrong,im new to programming) is 161 and something...that something wont affect de reverse of it? I was reading smth about that,but it wasnt explain on this side
14th Oct 2017, 6:50 AM
derXred
derXred - avatar
+ 2
tips: 1) find out the length of the palindrome 2) first character(number,letter w/e) must be equal with the last one (1=n), 2=n-1 an so on till you reach the middle of the sentence :) 3)depends on the type of the data in the sentence you should use the override method(i hope im not saying smth wrong :)) ). if you have only one type of data you dont need to use the override,but with it it will be more general Hope this helps a little :) edit: Hatsy Rei idea is more fast forward :) you should do that
14th Oct 2017, 3:16 AM
derXred
derXred - avatar