Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4. using namespace std;
  5. int main(int argc, char** argv) {
  6.  
  7. srand(time(NULL));
  8.  
  9. int temp[28][2];
  10. float srednia = 0;
  11.  
  12. for(int i = 0; i < 28; i++)
  13. {
  14. for(int j = 1; j < 2; j++)
  15. {
  16. temp[i][j] = rand() % 26;
  17. }
  18. }
  19.  
  20. for(int i = 0; i < 28; i++)
  21. {
  22. for(int j = 1; j < 2; j++)
  23. {
  24. if(i < 9)cout << "Dzien 0" << i+1 << ". " << temp[i][j] << endl;
  25. else if(i > 9)cout << "Dzien " << i+1 << ". " << temp[i][j] << endl;
  26. }
  27. }
  28.  
  29. for(int i = 0; i < 7; i++)
  30. {
  31. for(int j = 1; j< 2; j++)
  32. {
  33. srednia += temp[i][j];
  34. }
  35. }
  36.  
  37. cout << endl << "Srednia z pierwszego tygodnia: " << srednia / 7;
  38.  
  39. srednia = 0;
  40.  
  41. for(int i = 0; i < 28; i++)
  42. {
  43. for(int j = 1; j< 2; j++)
  44. {
  45. srednia += temp[i][j];
  46. }
  47. }
  48.  
  49. cout << endl << "Srednia z czterech tygodni: " << srednia / 28;
  50.  
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement