1023. The maximum number of questions

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_16525829/article/details/102773297

Title Description

Enter the number of integers, the input to mark the end of -1. Maximum output of which

Enter the
number of integers. (Marker input end in -1)

Output
largest number of them

Sample input
1257861-6-1

Sample output
8

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    c=INT_MIN;
    while(cin>>a>>b) 
    {
        if(a==-1||b==-1)
        break;
        c=max(a,c);
        c=max(b,c);
    }
    cout<<c;
    return 0;
}

Guess you like

Origin blog.csdn.net/qq_16525829/article/details/102773297