Back     Learn

Conditional 'If'

Practice

using namespace std ;

string today = " " ;

string weather = " " ;


if ( today == "saturday" || today == "sunday" )  {

    cout<<" Turn alarm off "<< endl ;

}   else  {

    cout<<" Set alarm at 7am "<< endl ;

}


if ( today == "monday" && weather == "rainy" )  {

    cout<<" I hate monday blues "<< endl ;

}   else  {

    cout<<" Just a normal day "<< endl ;

}

Output

Set alarm at 7am
Just a normal day