I was hoping for a bit of advice on cleaning a couple of areas of this code up. In particular, the hex-to-binary section, the checksum is in hex, and the rest is in ASCII. I tried for a good day to do it with tables etc, but in frustration I ended up going with this.Is there a better way of handling the Store individual characters in vector section? I went that way because the message can be of variable size (plus 1 or 2 characters).Here's an example of the type of message:!AIVDM,1,1,,A,13HOI:0P0000VOHLCnHQKwvL05Ip,0*23using namespace std;int main(){//Checksum Function//Get Characters for Checksumifstream AisMsg(nmea.txt, ios::in);    string MsgLine;    getline(AisMsg, MsgLine, '*');    MsgLine.erase(0,1);        string HexVal;        getline(AisMsg, HexVal);AisMsg.close();//Store individual characters in an element of an vectorint i = 0;int j = ( MsgLine.length() );vector <int> AsciiValues;{    bool done = false;    while (!done)    {        int h ( MsgLine.at (i) );        i++;        AsciiValues.push_back(h);    if ( i == j )        done = true;    }}//XOR validationbitset<8> a = (AsciiValues[0]);bitset<8> b = (AsciiValues[1]);bitset<8> c = a ^ b;    int d = 2;    int e = (AsciiValues.size());{    bool done = false;    while (!done)    {        a = (AsciiValues[d]);        b = c;        c = a ^ b;        d++;    if ( d == e )        done = true;    }}//Hex Checksum to Binary Conversion (messy, but does the job)int PosOne = HexVal.at(0);int PosTwo = HexVal.at(1);    bitset<4> z = PosOne;    bitset<4> x = PosTwo;        ofstream Cheat(Amateur Hour.txt, ios::out | ios::app);        Cheat << z << x << endl;        ifstream Cheat1(Amateur Hour.txt, ios::in | ios::binary);            string Chksm;            getline(Cheat1,Chksm);        Cheat.close();        Cheat1.close();        remove (Amateur Hour.txt);return 0;}
NMEA 0183 checksum validation
c++;validation