Advertisement
MariusPure

pavasaris

Jan 27th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. struct temperat{
  6. int num, did;
  7. };
  8.  
  9. temperat A[31];
  10.  
  11. void skaityti(int &n, temperat A[], tempDid[31])
  12. {
  13. ifstream d("U1duom.txt");
  14.  
  15. d >> n;
  16.  
  17. for(int i = 1; i <= n; i++) {
  18.  
  19. laikVntDid = 0;
  20. tempVidurkis = 0;
  21.  
  22. d >> A[i].num >> tempDid[0] >> tempDid[1] >> tempDid[2];
  23.  
  24. for(int i = 0; i < 3; i++) {
  25. if(laikVntDid < tempDid[i]) laikVntDid = tempDid[i];
  26. }
  27.  
  28. A[i].did = laikVntDid;
  29. }
  30. d.close();
  31.  
  32. }
  33.  
  34. int RastiDidTemp(int n, temperat A[]) {
  35. int AukstTemperD[31];
  36. int KokiaAukstTemp = 0;
  37. for(int i = 1; i <= n; i++) {
  38. if(KokiaAukstTemp < A[i].did) KokiaAukstTemp = A[i].did;
  39. }
  40. return KokiaAukstTemp;
  41. }
  42.  
  43. void kiekDienuAukst(int n, temperat A[]) {
  44. int AuksTempDienos[31];
  45. int AuksTempK = 0;
  46. for (int i = 1; i <= n; i++) {
  47. if(A[i].did == KokiaAukstTemp){
  48. AuksTempDienos[AuksTempK] = A[i].num;
  49. AuksTempK++;
  50. }
  51. }
  52. }
  53.  
  54. void NeZemesneUz21(int n, temperat A[])
  55. {
  56. int laikVntDid = 0;
  57. int mazDvides[31];
  58. int mazDvidN = 0;
  59. int tempVidurkis = 0;
  60. for(int i = 1; i <= n; i++)
  61. {
  62. laikVntDid = 0;
  63. tempVidurkis = 0;
  64.  
  65. tempVidurkis = (tempDid[0] + tempDid[1] + tempDid[2])/3;
  66. if(tempVidurkis >= 20) {
  67. mazDvides[mazDvidN] = A[i].num;
  68. mazDvidN++;
  69. }
  70.  
  71. }
  72. }
  73. int main() {
  74. int n = 0, tempDid[31];
  75. skaiciuoti(n,A);
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement