mercredi 11 novembre 2020

how do i create a loop back to original question with if or else?

I am trying to get if the person entered out of the range 1-10 to reprompt original question

#include <iostream>

int main() {
  int mood;
std::cout << "on a scale of 1-10 how are you? 1=worst 10=best ";
std::cin >> mood;
if ((mood<1)||(mood>10))
{
std::cout << "InVaID eNtry (UR fEElinGS ArE StiLL valID)";

}
else 
{std::cout << "I am feeling like a(n) " << mood;
}
  return 0;
}

Aucun commentaire:

Enregistrer un commentaire