+ 2
Palindrome Numbers, 46 code project in C++
Hello, I don’t really know how to do this project. Can somebody helps me?
3 Respostas
+ 7
Kilian ,
can you please post us your code here to get helpful responses from the community?
to give you some hints:
=> get a palindrome checker that works for strings and numbers
- take input as string (string1) and make a copy from this string (string2)
- take string2 and reverse it by using the inbuild reverse() function
- compare the reversed string (string2) to the original string (string1)
- if string1 matches to string2 (true), the input string is a palindrome, if comparison result is false, the input string is NOT a palindrome
Link to the c++ reference for reverse(): https://www.cplusplus.com/reference/algorithm/reverse/
happy coding!
+ 1
I think there is some mistake
0
//Thank you for your comment but I’m stuck, don’t now how to proceed. I’m a brand new coder and can’t complete this challenge.
#include <iostream>
using namespace std;
bool isPalindrome(int x) {
//complete the code hear
}
int main() {
int n;
cin >>n;
if(isPalindrome(n)) {
cout <<n<<" is a palindrome";
}
else {
cout << n<<" is NOT a palindrome";
}
return 0;
}