#include <iostream> using namespace std; int main4() { int a, b, c; cout << "a的体重:"; cin >> a; cout << endl; cout << "b的体重:"; cin >> b; cout << endl; cout << "c的体重:"; cin >> c; cout << endl; if (a > b) { if (a > c) { cout << a; } else{ cout << c; } } else { if (b > c) { cout << b; } else { cout << c; } } return 0; }
主要是比较的数量少,作三次判断就好,用if,else语句就好