基本语法

Untitled

例题:输出最大值最小值所有数的和

#include<iostream>
using namespace std;
int main()
{
    int sum = 0,maxN = 0,minN = 200,n;
    cin >> n;
    while(n != 0)
    {
        if(n > maxN)
            maxN = n;
        if(n < minN)
            minN = n;
        sum += n;
        cin >> n;
    }
    cout << maxN << " " << minN << " " << sum << endl;
    return 0;
}