Sir,
I have 2 column having so many points. In the 2nd column there r 3 highest peak points like(6,4 and3) bellow
6
5 5
4 4 4
3 3 3 3 3
2 2 2 2 2 2
1 1 1 1 1 1
2 3 4 5 6 7 8 9 0 11 12 13 14 15 16 17 18 19 20 21 22 23 24
How can i peak up these 3 points(6,4 and 3) and corresponding 1st column value like(7,14,21)above.
By the help of expert brother, i got the following code to input 2 column from txt file, is given bellow:
here test1 and test2 is 2 column. I am really waiting for it...
#include <vector> //Include the header for the vector data type
#include <iostream> //Accept input and give output.
#include<fstream>
using namespace std; //Using the std namespace for coding simplicity
int main(){
vector<double> test1,test2;
double num;
int i=0,j;
ifstream infile;
infile.open("input.txt");
while(true){
//First column
infile>>num;
if(!infile.good()) break; //If it's not good break.
if(infile.eof()) break; //If it's the end of the file break.
test1.push_back(num); //Back of the line for you, mister!
//Second column
infile>>num;
if(!infile.good()) break; //If it's not good break.
if(infile.eof()) break; //If it's the end of the file break.
test2.push_back(num); //Back of the line for you, mister!
i++; //And one more row please.
}
//Print them back out switched just for variety.
for(j=0;j<i;j++){
cout<<test2[j]<<"\t"<<test1[j]<<endl; //Notice I'm printing test2 first, then test1.
}
test1.clear(); //Clean up and free up!
test2.clear();
infile.close();
return 0;
}