代碼:
output("enter a number (!=0)");
input(max1) ;
if (max1==0) {
output("we need two numbers at least!!!");
abort();
}
output("enter a number (!=0)");
input(max2) ;
if (max2==0) {
output("we need two numbers at least!!!");
abort();
}
if (max2>max1) swap(max1, max2);
while (true) {
output("enter a number (0 to quit)");
input(n);
if (n==0) break;
if (n>max1) {
max2=max1;
max1=n;
} else if (n>max2) {
max2=n;
}
}
output(max1,max2);