Tripartite conditional operator (? :) Examples are as follows:
x? y:z;
The rules of the above three-eye conditional operation are: first calculate the value of expression X, if X is true, the result of the whole three-eye operation is the value of expression Y; If x is false, the result of the whole operation is the value of expression z.
The following example is to find a larger program from two numbers:
int a=3,b = 4;
int max = a & gtb? A: b;
The maximum value is 4.
Extended data:
C++ is the inheritance of C language, which can be used for procedural programming of C language, object-oriented programming characterized by abstract data types, and object-oriented programming characterized by inheritance and polymorphism. While C++ is good at object-oriented programming, it can also carry out process-based programming, so C++ can adapt to the size of the problem.
C++ not only has the practical characteristics of efficient computer operation, but also devotes itself to improving the programming quality of large-scale programs and the problem description ability of programming languages.