can someone help me, my code won't compile.

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

int main()
{

int hi, lo, mid;
bool found;
char status, reply;

do
{
     cout << "Think of a number between 0 and 1000" << endl;
     cout << " Write it down, I will guess it" << endl;
     hi = 1001;
     lo = 0;

     found = flase;
     while((hi >= lo) && (!found))
    {
               mid = (hi + lo) /2;
               cout << "is" << mid << "H) igh, L) ow, or C) orrect?"
               << endl;
               cin >> status;
               switch (toupper(status))
               {
                      case 'H':
                           hi = mid;
                           break;
                           case 'L':
                           lo = mid
                           break;
                           case 'C':
                                found = true;
                                break;
                                default:
                                        cout << "Invalid response!" << endl;
                                        }
                                        }

               if(hi < lo)
               cout << "You cheated" << endl;
               else
               cout << "Your number is " << mid << endl;
               cout << endl;
               cout << "Do you want to go again? Y or N" << endl;
               cin >> reply;
               }while(toupper(reply) == 'Y';
               return 0;
}

what are the eror(s)? Line up the { and } so that they are in the same column on the screen. Same for case statements, they should not be indented like they are shown in your post. Something like this example. Note: Your post will keep the spacing if you replace tabs with spaces. IDEs usually have an option to do that for you.

int main()
{
   if( something )
   {
       switch(x)
       {
          case 1:
             // blabla
             break;
          case 2:
            // blabla
            break;
          default:
            // blabla
            break;
        }
    }
}

Fix:
line 19, flase should be false
line 32, should be lo = mid;
line 49, should be }while(toupper(reply) == 'Y');

thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.