sort problem smallest largest number

  • Thread starter Thread starter RB _1
  • Start date Start date
R

RB _1

Guest
#include<iostream>
#include<vector>
#include <algorithm>

using namespace std;

int main()
{
vector<double>temps;//vector temps

double temp;// temp
int i=0;//initialize i



while(cin>>temp)//read to temp

{


temps.push_back(temp);//put in vector

sort(temps.begin(),temps.end());//sort

cout<<temps<<endl;//write it

//++i;//if i large about 1 (++i) then largest or without large then smallest
++i;
}


system("pause");
}

What ought i do ?

Actually write me largest number with ++I on the end , and smallest without this . How merge it ?

In order to if when I read number is smallest it remember it and write as smallest , if number read is biggest it remember it and write as largest . Actually it write smallest and largest number .

Continue reading...
 
Back
Top