-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector.cpp
More file actions
39 lines (33 loc) · 803 Bytes
/
vector.cpp
File metadata and controls
39 lines (33 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* =====================================================================================
*
* Filename: vector.cpp
*
* Description:
*
* Version: 1.0
* Created: 01/22/2021 12:40:05 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#include "std_lib_facilities.h"
int main()
{
vector<double> temps;
for(double temp; cin>>temp;)
temps.push_back(temp);
double sum;
for(double x : temps){
sum+=x;
}
cout<<temps.size()<<endl;
cout<<"the avg of temp is : "<<sum/temps.size()<<endl;
sort(temps);
cout<<"the median of temp is :" <<(temps[temps.size()/2] + temps[(temps.size()/2)-1])/2<<endl;
return 0;
}