Design a program that will ask the user to give three numbers and then the program will determine which of the three numbers has the highest in terms of numerical value using termary operator
// maximum.cpp
// Author: Mr jake R. pomperada, BSCS, MAED- IT
// Date: august 23, 2018 Thursday 10:55 pm
// Location: Bacolod City, Negros occidental
// Website: http://www.jakerpompereda.com
// maximum.cpp
// Author: Mr jake R. pomperada, BSCS, MAED- IT
// Date: august 23, 2018 Thursday 10:55 pm
// Location: Bacolod City, Negros occidental
// Website: http://www.jakerpompereda.com
#include <iostream>
using namespace std;
int main() {
int a, b, c, highest;
cout<<"Enter three numbers: ";
cin>>a>>b>>c;
highest = a > b ? (a > c ? a : c) : (b > c ? b : c);
cout<<"The highest number is: "<<highest;
cin>>a;
return 0;
}
Comments
Leave a comment