Untitled

mail@pastecode.io avatar
unknown
c_cpp
8 months ago
625 B
0
Indexable
Never
#include <iostream>

using namespace std;
#pragma warning(disable : 4996);

int main()
{	
	setlocale(LC_ALL, "Russian");
	int n = 0;
	int a;
	double sum = 0;
	int count = 0;
	double sred = 0;

	cout << "1 - поставить новую оценку" << endl;
	cout << "2 - вывести средний былл" << endl;
	cout << "3 - выйти из дневника" << endl;

	while (n != 3){
		cin >> n;
		switch (n) {

		case 1:
			cin >> a;
			count += 1;
			sum += a;
			break;

		case 2:
			sred = sum / count;
			cout << sred << endl;
			break;

		case 3:
			return 0;
		}
	}
}