// Finds the largest value of three numbers. \ // demonstrates the use of conditional assignment // Mikhail Nesterenko // 2/1/2001 #include using namespace std; int main() { // read in the three numbers int n1, n2, n3; cout << "Please enter three numbers: "; cin >> n1 >> n2 >> n3; // find the largest value int largest = n1; // assume the first number is the largest // check if we have a new largest value largest = largest < n2 ? n2 : largest; largest = largest < n3 ? n3 : largest; // print the largest value out cout << "Largest number of " << n1 << ", " << n2 << " or " << n3 << " is " << largest << '\n'; }