Hi Im working on a program at the moment and seem to be having issue with this section when trying to get section 3 i get section 2 Ive pasted code below any help or suggestions would be great. Thanks

if(gps=='Y'||gps=='y'&&childseat=='N'||childseat=='n')
    {
        if(stoi(daysamount)<=3)
        {
            extra=stoi(daysamount)*5;
        }
        else
        {
            extra=15;
        }
        cout<<setw(43)<<"Cost Of Extras :1"<<"      "<<extra<<endl<<endl;
    }
    else if(gps=='N'||gps=='n'&&childseat=='Y'||childseat=='y')
    {
        if(stoi(daysamount)<=12)
        {
            extra=stoi(daysamount)*12;
        }
        else 
        {
            extra=149;
        }
        cout<<setw(43)<<"Cost Of Extras :2"<<"      "<<extra<<endl<<endl;
    }
    else if(gps=='Y'||gps=='y'&&childseat=='Y'||childseat=='y')
    {
        if(stoi(daysamount)<=3)
        {
            extra=stoi(daysamount)*5;
        }
        else
        {
            extra=15;
        }
        if(stoi(daysamount)<=12)
        {
            extra=extra+stoi(daysamount)*12;
        }
        else 
        {
            extra=extra+149;
        }
        cout<<setw(43)<<"Cost Of Extras :3"<<"      "<<extra<<endl<<endl;
    }
    else
    {
        cout<<endl<<endl;
    }

|| has lower precedence than &&. To get the appropriate behavior (granted I'm assuming what behavior you want), you need parentheses:

(gps == 'Y' || gps == 'y') && (childseat == 'N' || childseat == 'n')

Thanks for that its always something small and thats been staring at me for most of the day... cheers

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.