• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# asd

a guest Feb 16th, 2020 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include <iostream>
2. #include <cmath>
3.
4. using namespace std;
5.
6. int main()
7. {
8.     double temps[14];
9.     for (int i=0;i<14;i++) {
10.         printf("Kerem adja meg az %d. nap maximum homersekletet!\n",i+1);
11.         cin >> temps[i];
12.     }
13.     double max=0;
14.     for (int i=0;i<14;i++) {
15.         if (max<temps[i])
16.         {
17.             max=temps[i];
18.         }
19.     }
20.     cout << "\033[2J\033[1;1H";
21.     cout << "A legmagasabb homerseklet:" << max << endl;
22.     cout << "A napok amelyeken a maximum homerseklet volt:";
23.     for(int i=0;i<14;i++)
24.     {
25.         if(temps[i]==max)
26.         {
27.             cout << i+1 << ",";
28.         }
29.     }
30.     cout << endl;
31.     double sum = 0;
32.     for (double x : temps) {
33.         sum += x;
34.     }
35.     double avg = sum/14;
36.     cout << "Az elmult ket het atlaga:" << avg << endl;
37.     double firstweeksum=0;
38.     for (int i=0;i<7;i++) {
39.         firstweeksum+=temps[i];
40.     }
41.     double secondweeksum=0;
42.     for (int i=7;i<14;i++) {
43.         secondweeksum+=temps[i];
44.     }
45.     if(firstweeksum/7 > secondweeksum/7)
46.     {
47.         cout << "Az elso het atlaga nagyobb!" <<endl;
48.     }
49.     if (secondweeksum/7 > firstweeksum/7){
50.         cout << "A masodik het atlaga nagyobb!" <<endl;
51.     }
52.     if (secondweeksum/7 == firstweeksum/7){
53.         cout << "A ket het atlaga megegyezik!" <<endl;
54.     }
55.     double deviation=0;
56.     for (int i=0;i<14;i++) {
57.         deviation=deviation+pow(temps[i]-avg,2);
58.     }
59.
60.     double stddeviation = sqrt(deviation/10);
61.     double percentages[3] = {68,95,99.7};
62.     for (int i=0;i<3;i++) {
63.         printf("%f of data falls within %d standard deviation from the mean - that means between %f and %f",percentages[i],i+1,avg-stddeviation*(i+1),avg+stddeviation*(i+1));
64.         cout << endl;
65.     }
66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top