Need help with computer science on stopping the loop with a certain input, C++

Dec 20th, 2015
Price: $5 USD

Question description

I need when the output is not "stop" to run the loop (works right now). I need when input is "stop" for the loop to stop, it is not stopping right now. i also need a detector of characters from input, like recognizing certain characters I pick out. (array??)

it is a quick fix, so it won't take long to correct

int main(){
  string input;
  cout << "Input 'stop' when you wish to exit. " << endl;

if(input != "stop"){
  while(input != "stop"){
  cout << "Enter input: ";
  cin >> input;

  cout << "Backwards:  " << input << endl;

  //if input is same backwards, it is a palindrome, so print out "Palindrome!" in that case
  if(input == input){
  cout << "Palindrome!" << endl;
  cout << endl;
  return 0;

Tutor Answer

(Top Tutor) shyamnair3
School: Purdue University

Studypool has helped 1,244,100 students

Review from student
" Excellent job "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1828 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors