Under what circumstances does C++ use && or and ? RRS feed

  • Question

  • Being new to C++ and doing a bit of “teach myself” I came across an anomaly which I would like to resolve. My first step was to follow a tutorial which led me to start with the Wizard that produces a console app that prints “Hello World” by selecting Console App C++. So I assumed I was learning C++.

    In an app I was developing I successfully used two lines of code:

    if (col < 9 and col > 5)

    col1 = 6;

    I then eventually moved on to wanting my output to be in a window and started by using the Wizard: Windows runtime component (Universal Windows – C++) only to find the above code does not work and eventually found I needed to use

    if (col < 9 && col > 5)

    col1 = 6;

    Now both apps are within Visual Studio and both Wizards indicate they are setting up C++. So my question is which code is C++ and why is Visual Studio not consistent?

    And just to have a bit of stress relief “Its hard enough trying to teach myself without having  inconsistencies.

    Tuesday, November 12, 2019 10:38 AM


All replies