EOF是一个预定义的常量,等于-1. 输入A和B,计算并输出A+B Sample input: 1 5 10 20 Sample output: 6 30 #include <iostream> using namespace std; int main() { int a, b; while(cin >> a >> b) cout << a + b << endl; return 0; } *******…
完成几个小代码练习?让自己更加强大?学习新知识回顾一下基础? 1.输入数组计算最大值 2.输出数组反向打印 3.求数组平均值与总和 4.键盘输两int,并求总和 5.键盘输三个int,并求最值 /* 要求:输入一组数组,计算出最大值. */ public class cesi{ public static void main (String[] args) { int[] array = {5, 15, 100, 999, 1000}; int max = array[0]; for (int…