Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- int main(int argc, char** argv) {
- srand(time(NULL));
- int temp[28][2];
- float srednia = 0,srednia2 = 0;
- int asd = 1;
- int min,max;
- for(int i = 0; i < 28; i++)
- {
- for(int j = 1; j < 2; j++)
- {
- temp[i][j] = rand() % 26;
- }
- }
- for(int i = 0; i < 28; i++)
- {
- for(int j = 1; j < 2; j++)
- {
- if(i < 9)cout << "Dzien 0" << i+1 << ". " << temp[i][j] << endl;
- else if(i > 8)cout << "Dzien " << i+1 << ". " << temp[i][j] << endl;
- }
- }
- for(int i = 1; i < 29; i++)
- {
- for(int j = 1; j< 2; j++)
- {
- srednia += temp[i-1][j];
- if((i % 7) == 0)
- {
- cout << endl << "Srednia z "<< asd <<" tygodnia: " << srednia / 7;
- asd = asd + 1;
- srednia = 0;
- }
- }
- }
- srednia = 0;
- for(int i = 0; i < 28; i++)
- {
- for(int j = 1; j< 2; j++)
- {
- srednia += temp[i][j];
- }
- }
- cout << endl << "Srednia z czterech tygodni: " << srednia / 28;
- min = temp[0][1];
- max = temp[0][1];
- for(int i = 1; i < 28; i++)
- {
- for(int j = 1; j < 2; j++)
- {
- if(min > temp[i][j])
- {
- min = temp[i][j];
- }
- if(max < temp[i][j])
- {
- max = temp[i][j];
- }
- }
- }
- cout << endl << "Najnizsza temperatura: " << min << endl << "Najwyzsza temperatura: " << max;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement