Facebook
From LiLo, 3 Years ago, written in Plain Text.
This paste is a reply to Untitled from LiLo - go back
Embed
Viewing differences between Untitled and Re: Untitled
#include 
#include 
#include 
#include 
#include 
#include  
#include  
 

#include  

using namespace std;

std;
using namespace std::chrono;

int main(void) { 
    auto start = high_resolution_clock::now();
    int i = 0;
    int f;
    fstream ifstream newfile;
    newfile.open("testInput.txt", ios::in); 
txt"); 
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast(stop - start);
    cout << duration.count() << endl;

    if (newfile.is_open()) { 
        list list l1;
        int map > myOrder;
        
        string 
*p;
        string line;
        start = high_resolution_clock::now();
        while (getline(newfile, line)) {
            string line;\n            getline(cin, line);\n            f = line.find("|");
            p = new int[2];
            //cout 
string[2];
            /*cout 
<< stoi(line.substr(0, f - 1));
            
line << endl;*/
            
p[0] = stoi(line.(line.substr(0, f));
            p[1] = stoi(line.(line.substr(f + 1, string::npos));
string::npos));

            if (myOrder.find(p[0]) == myOrder.end()) {
                //not found
                myOrder[p[0]][p[1]] = 1;
            }
            else {

                if (myOrder[p[0]].find(p[1]) == myOrder[p[0]].end())
                    myOrder[p[0]][p[1]] = myOrder[p[0]].size() + 1;
            }
            l1.push_back(p);
            
        }
        stop = high_resolution_clock::now();
        duration = duration_cast(stop - start);
        cout << duration.count() << endl;

        newfile.close(); 
        /*while while (!l1.empty()) {
            p = l1.front();
                       /* std::cout <<< "List contains: of " << myOrder[p[0]].size() <<"]"<< std::endl;*/
            ofstream myfile;
            myfile.open("example.txt", ios::app);
            myfile 
<< p[0] << " " "|" << p[1] << std::endl;
"[" << myOrder[p[0]][p[1]] << " of " << myOrder[p[0]].size() << "]" << std::endl;
            myfile.close();
            l1.pop_front();
            delete[] p;
        }*/
    }

    
}
    }  
}