dimanche 4 décembre 2022

Increment a hexadecimal string in C++

I want to increment a hexadecimal string in C++. The hexadecimal string starts "013802bf0000000000000000" and I want to increment it to "013802bf0000000000000001", ... ,"013802bf000000000000000f", ... etc till I hit " 013802bfffffffffffffffff ".

#include <iostream>
#include <conio.h>
#include <cstdlib>
#include <string>
#include <sstream>
using namespace std;
using std::string;
using std::cout;
using std::endl;

void main(double argc, char* argv[])
{
    string input = "013802bf0000000000000000";
    for (int i = 0; i < 10; i++)
    {
      cout<< input << endl;


    }
    _getch();
}

I want to increment it to "013802bf0000000000000001", ... ,"013802bf000000000000000f", ... etc till I hit " 013802bfffffffffffffffff ".

Aucun commentaire:

Enregistrer un commentaire