i wrote a code which should accept only two values, but it seems to accept any values instead. can some show me where i went wrong.
sorry about the long code, still a newbie at this.

double hr::change_r(double sr) //implementation from class section
{
   dr = sr;   
    if(sr == 17)
      return 17;
    else  
      return dr; 
}

int main()  // the main section
{
   int s
  cout<<"Enter amount: ";
  cin>>s;
   if (HR.change_r(s) == 11)
    {
          cout<<"regular\n";
    }
    if (HR.change_r(s) == 17)
    {
          cout<<"irregular\n";
    }
    if((HRoom.change_rate(season) < 150.00) &&     (HRoom.change_rate(season) > 150.00) || (HRoom.change_rate(season) < 175.00) &&(HRoom.change_rate(season) > 175.00))
    {
           cout<<"Incorrect room rate entered";
           cin>>season;
    while((HRoom.change_rate(season) < 150.00) && (HRoom.change_rate(season) > 150.00) || (HRoom.change_rate(season) < 175.00) &&(HRoom.change_rate(season) > 175.00))
     {
                cout<<"Please re-enter the room rate \n";
                cin>>season; 
      }

Edited 3 Years Ago by mike_2000_17: Fixed formatting

i take it you are trying to see if the user entered 150 or 175 as the rate and if they do not then tell them they have a wrong entry and re ask for the room rate a simple way for this would be to do this

int rate // this can be any type
cout << "Please enter the room rate: ";
cin >> rate
if ((rate != 150) || (rate != 175)// this will make sure you only get 150 or 175
{
// loop for the right response
This question has already been answered. Start a new discussion instead.