DEV Community

Mohammed Salah
Mohammed Salah

Posted on

C++28th code (The ternary operator in C++ )

    #include<iostream>
    using namespace std; 
    int main()
    {
float a,b;
cout<<" \n\tEnter First number : "; 
cin >> a; 
cout<<"\n\t  ===========================\n "; 
cout<<"\n\t Enter Second number : " ; 
cin>>b; 
cout<<"\n\t  ===========================\n "; 
//The ternary operator in C++
//condition ? expression1 : expression2;
float Max = (a>b)? (a): (b);
cout<<"\n\t The Max Value is = "<<Max; 
cout<<"\n\n\t  ===========================\n "; 
cin.get();
return 0 ; 
    }
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Dev Diairies image

User Feedback & The Pivot That Saved The Project

🔥 Check out Episode 3 of Dev Diairies, following a successful Hackathon project turned startup.

Watch full video 🎥

👋 Kindness is contagious

Explore this insightful write-up embraced by the inclusive DEV Community. Tech enthusiasts of all skill levels can contribute insights and expand our shared knowledge.

Spreading a simple "thank you" uplifts creators—let them know your thoughts in the discussion below!

At DEV, collaborative learning fuels growth and forges stronger connections. If this piece resonated with you, a brief note of thanks goes a long way.

Okay