#include <iostream>
#include <iomanip>
#include <conio.h>
#include <random>
using namespace std;
int main()
{
float a;
int d, b, c, min, max;
cout << "Iteracja cwiczenia\n\n";
srand(time(nullptr));
min = max = rand() % 99;
cout << "Wartosci zmiennych przed petla\n"
<< "min = " << min << "\n"
<< "max = " << max << "\n"
<< "c = " << c << "\n"
<< "d = " << d << "\n" << endl;
for (int i = 1; i <5; i++)
{
d = c = rand() % 99;
cout << "Dla i = " << i << "\n"
<< "Przed if\n"
<< "c = " << c << ", d = " << d << "\n"
<< "min = " << min << ", max = " << max << "\n\n";
if (min > c) c = min;
if (max < d) d = max;
cout << "Po if\n"
<< "c = " << c << ", d = " << d << "\n"
<< "min = " << min << ", max = " << max << "\n" << endl;
}
a = (min + max) / 2;
cout << "Wartosci zmiennych po petli\n"
<< "min = " << min << "\n"
<< "max = " << max << "\n"
<< "c = " << c << "\n"
<< "Srednia: "<< fixed << setprecision(2) << a << endl;
//system("pause");
return 0;
}