bool flag

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • help1267
    New Member
    • Aug 2006
    • 10

    #1

    bool flag

    C++ question: I've initialized some data elements in the int main function. the fourth element is a bool flag (set to false = 0). When I call a class function and that function tries to change the flag to true it doesn't work.

    ---
    int main()
    Calculate OB1 (4,25,25,0)
    ...

    Class member function...
    ...
    if (flag=0)
    {
    ....
    {
    else
    ...

    My constructor is:
    void set (int avg=0, int high=0, int low=0, bool f=0);

    Do you know why my flag isn't being triggered if the user is inputting 1 for True ?

    Thanks for your help. 1267
  • D_C
    Contributor
    • Jun 2006
    • 293

    #2
    Originally posted by help1267
    if (flag=0)
    That is setting flag to false again. if(flag==0) is how to test whether flag is false. You need to add another equals sign in there.

    Comment

    • help1267
      New Member
      • Aug 2006
      • 10

      #3
      I tried that too and it doesn't work.

      Comment

      • D_C
        Contributor
        • Jun 2006
        • 293

        #4
        Post the entire code and collectively we will figure out what's wrong with it.

        Comment

        Working...