ticket office is difficult (I can't do this)
I coded here. #include <iostream> using namespace std; int main() { int ages[5]; double minage; // for (int i = 0; i < 5; ++i) { // cin >> ages[i]; // } ages[0] = 27; ages[1] = 20; ages[2] = 14; ages[3] = 40; ages[4] = 50; for(int i = 0; i < 5; ++i) { if(ages[i] < 0) {cout << "age is plus"; return 0;} } //your code goes here if(ages[0] <= ages[1]) { if(ages[0] <= ages[2]) { if(ages[0] <= ages[3]) { if(ages[0] <= ages[4]) { minage = ages[0]; if(50.0 - 0.5 * minage < 0) {cout << 0.0; return 0;} cout << 50.0 - 0.5 * minage << endl; } } } } if(ages[1] <= ages[0]) { if(ages[1] <= ages[2]) { if(ages[1] <= ages[3]) { if(ages[1] <= ages[4]) { minage = ages[1]; if(50.0 - 0.5 * minage < 0) {cout << 0.0; return 0;} cout << 50.0 - 0.5 * minage << endl; } } } } if(ages[2] <= ages[0]) { if(ages[2] <= ages[1]) { if(ages[2] <= ages[3]) { if(ages[2] <= ages[4]) { minage = ages[2]; if(50.0 - 0.5 * minage < 0) {cout << 0.0; return 0;} cout << 50.0 - 0.5 * minage << endl; } } } } if(ages[3] <= ages[0]) { if(ages[3] <= ages[1]) { if(ages[3] <= ages[2]) { if(ages[3] <= ages[4]) { minage = ages[3]; if(50.0 - 0.5 * minage < 0) {cout << 0.0; return 0;} cout << 50.0 - 0.5 * minage << endl; } } } } if(ages[4] <= ages[0]) { if(ages[4] <= ages[1]) { if(ages[4] <= ages[2]) { if(ages[4] <= ages[3]) { minage = ages[4]; if(50.0 - 0.5 * minage < 0) {cout << 0.0; return 0;} cout << 50.0 - 0.5 * minage << endl; } } } } return 0; } I cannot do this with test 3. Why? If age is NOT zero from 100, how do I do? Or, please show me the test 3's input data? :) I will use pen and paper....