I am trying to write industry standard code.https://www.quora.com/How-do-I-follow-a-user-on-Spoj-for-solving-problems-Refer-DetailsSomeone gave me this A2A.And I wrote this code for it//compile with g++ -std=c++11#include <bits/stdc++.h>using namespace std;struct PROBLEM{    string name;    string links;    int users;    double points;};bool compare (PROBLEM & p1 , PROBLEM & p2){    return p1.users < p2.users;}void savePage(string & username){    string url = http://www.spoj.com/users/ + username +/;    string cmd = curl  + url +  > + username + .txt;     system (cmd.c_str());}bool checkRegex(string & str){    return regex_match (str , std::regex(^\\s{0,}<td\\salign.{0,}$));}bool checkRegexProb(string & str){    return regex_match(str , std::regex(^\\s{0,}<td\\sclass=\t.{0,}$));}int getNum(string & str){    int i;    string temp;    for (i = 0 ; str[i] != '>' ; i++);    i++;        for(;str[i] != '<' ; i++)        temp += str[i];    return stoi(temp);}int getUsers(string & str){    string url = http://www.spoj.com/ranks/ + str + /;    string cmd = curl  +url +  > + str +.txt;    system(cmd.c_str());    string filename = str + .txt;    int Count = 0;    ifstream myfile(filename.c_str());    if (myfile)      {        string line;        while (getline( myfile, line ))          {            if (checkRegexProb(line) )            {                Count ++;                if(Count == 2)                {                    myfile.close();                    string deleteFile = rm -r  + filename;                    system(deleteFile.c_str());                      return getNum(line);                }                       }           }    }   }vector<PROBLEM> readFile(string & username){    std::vector<PROBLEM> v;    string filename = username + .txt;    ifstream myfile(filename.c_str());    if (myfile)      {        string line;        while (getline( myfile, line ))          {            if (checkRegex(line) )            {                string temp;                size_t found = line.find(/status/);                for(size_t i = found + 8 ; line[i]!=',' ; i++)                    temp += line[i];                if(temp != )                {                    PROBLEM p;                    p.name = temp;                    p.users = getUsers(p.name);                    while(p.users == 0)                        p.users = getUsers(p.name); // bug -> curl gives empty response                    v.push_back(p);                }               }        }        myfile.close();    }    return v;}void makeLink(std::vector<PROBLEM> & v){    for(int i = 0 ; i < v.size() ; i++)        v[i].points = 80.0/(40.0+ v[i].users),        v[i].links = <a href =\ http:://www.spoj.com/problems/ + v[i].name +\>  + v[i].name + + to_string(v[i].points) +</a> <br>;}string makeHtml(std::vector<PROBLEM> & v){    string list ;    for (int i = 0 ; i < v.size() ; i++ )        list += v[i].links;    string HTML =     <html><body>+ list +</body></html>;    return HTML;}int main(int argc, char const *argv[]){    string username ;    cin >> username ;    savePage(username) ;    std::vector<PROBLEM> v = readFile(username);    sort(v.rbegin(), v.rend(),compare);    makeLink(v);    std::ofstream outfile ((username + .html).c_str());    outfile <<makeHtml(v);    system((rm -f + username + .txt).c_str());    system((gnome-open  + username + .html).c_str());       return 0;}How can I improve it so that it matches industry standard?
Crawling SPOJ through cURL and C++
c++;c++11;bash;web scraping;curl
A few more possibilities to consider:pre-compille your regular expressionsCompiling a regular expression is (potentially) a somewhat expensive operation. In this case, the regular expressions remain constant throughout the program, so you might as well compile them once, and use the compiled regular expression after that:bool checkRegex(string & str){    static std::regex pattern{^\\s{0,}<td\\salign.{0,}$};    return regex_match (str , pattern);}use operator overloading where sensibleFor example, your compare function:bool compare (PROBLEM & p1 , PROBLEM & p2){    return p1.users < p2.users;}...really makes more sense as an overload of operator<:bool operator<(PROBLEM & p1 , PROBLEM & p2){    return p1.users < p2.users;}const correctnessTaking the operator above a step further, we don't want x < y to modify either x or y, so we should pass the operands by const reference:bool operator<(PROBLEM const &p1 , PROBLEM const &p2){    return p1.users < p2.users;}This way, when we sort our vector of Problem objects, we don't need to explicitly specify how to compare them:sort(v.rbegin(), v.rend());Use the force library, LukeIn addition to a command line utility, cURL is available as a library that you can use in your program. There's also a cURLpp library that provides a C++ wrapper around libcurl, which you may prefer. Either can help you write code that's quite a bit simpler and more readable.Work with the library, not against itRight now, you have (for example) a readFile to read the contents of a file into a vector of PROBLEM. That's not really how the standard library is meant to work though. To work optimally with it, you really just want to overload operator>> to read one PROBLEM from the file. Once you have that, you can (for example) use stream iterators to read from a file into a vector.class Problem {     // ...    friend std::istream &operator>>(std::istream &is, Problem &p) {         // code to read one Problem from the stream goes here        return is;    }};Then we can initialize our vector from a pair of iterators:std::ifstream in(input.txt);std::vector<Problem> v{ std::istream_iterator<Problem>(in), {} };