简体   繁体   中英

Error code expected a')' occurring on logical operators

This error code just appeared all of a sudden and this never happened before. It has a red under line on all of the logical operators like (and, or) and it shows the error expected a')' but the code is running well. Does somebody know why this is happening?

Here's the sample code

    while (item_list[index].title != item and index != last + 1) //error occurs here underlines red at the and operator
    {
        ++index;
    }
    if (index != last + 1)
    {
        cout << "Item is found at row " << index + 1 << "\n";
    }
    else
    {
        cout << "Item is not found in the table"
             << "\n";
    }

The problem is the following line:

while (item_list[index].title != item and index != last + 1)

change the and to &&, there is no operator called and in C++ only && no and....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM