File indexing completed on 2024-04-06 11:58:24
0001 #include <iostream>
0002 #include <fstream>
0003 #include <vector>
0004 #include <iostream>
0005 #include <string>
0006
0007 int main(){
0008
0009 const int MAX_SIZE = 252288;
0010
0011 int old_index;
0012 float old_ped, old_rms;
0013 std::vector<int> old_index_id;
0014 std::vector<float> old_peds;
0015 std::vector<float> old_pedrms;
0016 int new_index;
0017 float new_ped,new_rms;
0018 std::vector<int> new_index_id;
0019 std::vector<float> new_peds;
0020 std::vector<float> new_pedrms;
0021 std::vector<float> diff;
0022 std::vector<float> myoldpeds;
0023
0024 int counter,counter1;
0025 int old_nrlines=0;
0026 int new_nrlines=0;
0027
0028 std::ifstream olddata;
0029 olddata.open("goodPeds2008_09_02.dat",std::ios::in);
0030 if(!olddata) {
0031 std::cerr <<"Error: goodPeds2008_09_02.dat -> no such file!"<< std::endl;
0032 exit(1);
0033 }
0034
0035 while (!olddata.eof() ) {
0036 olddata >> old_index >> old_ped >> old_rms ;
0037 old_index_id.push_back(old_index);
0038 old_peds.push_back(old_ped);
0039 old_pedrms.push_back(old_rms);
0040 old_nrlines++;
0041 }
0042 olddata.close();
0043
0044 std::ifstream newdata;
0045 std::ofstream myPedsFile("diffPedsOct_Feb.dat",std::ios::out);
0046 newdata.open("goodPeds2009_02_16.dat",std::ios::in);
0047 if(!newdata) {
0048 std::cerr <<"Error: goodPeds2009_02_16.dat -> no such file!"<< std::endl;
0049 exit(1);
0050 }
0051
0052 while (!newdata.eof() ) {
0053 newdata >> new_index >> new_ped >> new_rms ;
0054 new_index_id.push_back(new_index);
0055 new_peds.push_back(new_ped);
0056 new_pedrms.push_back(new_rms);
0057 new_nrlines++;
0058 }
0059 newdata.close();
0060 diff.resize(MAX_SIZE);
0061 myoldpeds.resize(MAX_SIZE);
0062
0063 for(int i=0; i<MAX_SIZE;++i){
0064 counter=old_index_id[i];
0065 myoldpeds[i]=old_peds[i];
0066
0067 for (int k=0;k<new_index_id.size()-1;k++){
0068 counter1=new_index_id[k];
0069 if(counter == counter1){
0070 diff[k]=old_peds[i] - new_peds[k];
0071
0072 myPedsFile<<counter<<" "<<diff[k]<<std::endl;
0073 }
0074 }
0075 }
0076 }