0

palindrome program isn't working using character array

#include <iostream> using namespace std; #include <conio.h> main() { int n; cout << "Enter the Size of character array" << endl; cin >> n; char name[n]; cout << "Enter your name" << endl; cin >> name; int count = 0, i = 0; while (name[i] != '\0') { count++; i++; } cout << "Your name is of " << count << " characters" << endl; int j = 0, k = count; bool flag = true; while ( j <= k) { if (name[j] != name[k]) { flag = false; break; } else if (name[j] == name[k]) { j++; k--; } } if (flag == true) { cout << "True"; } else { cout << "False"; } }

21st Sep 2021, 1:40 PM
Minhaj Haider
Minhaj Haider - avatar
3 Respostas
21st Sep 2021, 3:33 PM
Abhay
Abhay - avatar
0
This program is not working This program is about palindrome or not using character array
21st Sep 2021, 5:09 PM
Minhaj Haider
Minhaj Haider - avatar