Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <future>
- using namespace std;
- typedef vector<double>::iterator it;
- class Min {
- public:
- double operator()(it begin, it end){
- double min = 0;
- min = *begin;
- for(; begin != end; begin++) {
- if(min > *begin) {
- min = *begin;
- }
- }
- return min;
- }
- };
- int main() {
- vector<double> vec;
- it iter;
- double minimum = 0;
- double n = 0;
- cout<<"Unesi: "<<endl;
- while(cin>>n) {
- vec.push_back(n);
- }
- Min min;
- for (iter = vec.begin(); iter != vec.end(); iter++) {
- auto a = async(min, vec.begin(), vec.end());
- minimum = a.get();
- }
- cout<<minimum<<endl;
- }
Add Comment
Please, Sign In to add comment