Check the symmetric of an array

This is my program so far. I wanted to use pointer and its arithmetic to check if an English word is symmetric.

example:
String Entered: I am Super. Super, Am i?
Given word array: I am Super super Am i
==>eliminate left right: am Super super Am
==>eliminate left right: Super super
==>eliminate left right: empty.
Conclusion : symmetric
------------------------------------------------------------

#include <iostream>
#include <iomanip>
using namespace std;

const int MAX = 80; //each token is 80 characters
const int MAXTOKENS = 20; //array of 20 tokens e.g I am Man.==> 3 tokens
typedef char * Token;

int main ()
{
char tokenArray [MAXTOKENS][MAX];
char str [MAX];

char cont;

do
{
cout << "Enter a string: ";
cin.getline (str, MAX);

char *p = strtok (str, ".,? !");

//-------------------------------
int i = 0;

while (p != NULL)
{
strcpy (tokenArray [i], p);

p = strtok (NULL, ".,? !");

i++;
}

cout<<"No of words = "<< i <<endl;

cout <<"\n"<<"Given word array: ";
for (int k = 0; k < i; k++)
cout << tokenArray [k] <<" ";

//-------------------------------
cout << endl;
cout <<"\n"<<"Analysis" <<endl;
cout <<"--------" <<endl;
cout <<"==> Eliminate left right:" <<endl;
cout <<"==> Eliminate left right:" <<endl;
cout <<"==> Eliminate left right:" <<endl;
cout <<"Conclusion:" <<endl;

//-------------------------------
cout<<"\n"<<"Continue (y/n):";
cin >> cont;

cout << setw (75) << setfill ('=') << "=" << endl;
cin.clear();
cin.ignore(100,'\n');

}while (cont == 'y');
}
Topic archived. No new replies allowed.