Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- double temps[14];
- for (int i=0;i<14;i++) {
- printf("Kerem adja meg az %d. nap maximum homersekletet!\n",i+1);
- cin >> temps[i];
- }
- double max=0;
- for (int i=0;i<14;i++) {
- if (max<temps[i])
- {
- max=temps[i];
- }
- }
- cout << "\033[2J\033[1;1H";
- cout << "A legmagasabb homerseklet:" << max << endl;
- cout << "A napok amelyeken a maximum homerseklet volt:";
- for(int i=0;i<14;i++)
- {
- if(temps[i]==max)
- {
- cout << i+1 << ",";
- }
- }
- cout << endl;
- double sum = 0;
- for (double x : temps) {
- sum += x;
- }
- double avg = sum/14;
- cout << "Az elmult ket het atlaga:" << avg << endl;
- double firstweeksum=0;
- for (int i=0;i<7;i++) {
- firstweeksum+=temps[i];
- }
- double secondweeksum=0;
- for (int i=7;i<14;i++) {
- secondweeksum+=temps[i];
- }
- if(firstweeksum/7 > secondweeksum/7)
- {
- cout << "Az elso het atlaga nagyobb!" <<endl;
- }
- if (secondweeksum/7 > firstweeksum/7){
- cout << "A masodik het atlaga nagyobb!" <<endl;
- }
- if (secondweeksum/7 == firstweeksum/7){
- cout << "A ket het atlaga megegyezik!" <<endl;
- }
- double deviation=0;
- for (int i=0;i<14;i++) {
- deviation=deviation+pow(temps[i]-avg,2);
- }
- double stddeviation = sqrt(deviation/10);
- double percentages[3] = {68,95,99.7};
- for (int i=0;i<3;i++) {
- 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));
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement