PracticeDev/study_cpp/cpp_primer_source_code/Chapter 6/condit.cpp

16 lines
383 B
C++

// condit.cpp -- using the conditional operator
#include <iostream>
int main()
{
using namespace std;
int a, b;
cout << "Enter two integers: ";
cin >> a >> b;
cout << "The larger of " << a << " and " << b;
int c = a > b ? a : b; // c = a if a > b, else c = b
cout << " is " << c << endl;
// cin.get();
// cin.get();
return 0;
}