c++ - How to check Palindromic lists -


i know how can write function determine if list read in bellow code palindromic? e.g if list of numbers 123456 program print out "this list not palindrome" , if list 12321 print out "this list palindrome".

any appreciated.

void poparray(int array1[]) {     ifstream infile("test1.txt");     if (!infile) {         cout << "can't open file: " << endl;         exit(exit_failure);     }     (int = 0; < 10; i++) {         infile >> array1[i];         cout << setw(2) << array1[i];     } } void reverselist(int array1[]) {     (int x = 9; x > -1; x--) {         cout << setw(2) << array1[x];     } } 

i'd suggest using index i , have go 0 size/2. inside loop comparing list[i] == list[(size - 1) - ].


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -