I need help with loops?

I need to add a loop, so that it when it finishes it will ask for a word again, until I type "End"

#include <fstream>
#include <iostream>
#include <cstring>
using namespace std;

int main()
{
char wordenter[80];
int length;

cout<<"Enter a word\n";
cin>>wordenter;
cin.get();
length = strlen(wordenter);
cout<<"You enter the word "<<wordenter<<" with the length of "<<length<<endl;


int i, j, palindrome;
for (i=0, j=length-1, palindrome=1; j>i; j--, i++)
{
if(toupper(wordenter[i]) != toupper(wordenter[j]))
{
palindrome = 0;
break;
}
}
cout<<"Word "<<wordenter<<(palindrome?" is":" is not")<<" a palindrome."<<endl;
cin.get();
return 0;

}
1
2
3
4
5
6
7
8
9
while ( true )
{
   cout<<"Enter a word\n";
   cin>>wordenter;
   cin.get();

  if ( strcmp( wordenter, "End" ) == 0 ) break;
// other stuff
}
Topic archived. No new replies allowed.