jeudi 31 mai 2018

Formating integers

What is the c++ 11 equivalent of C# ToString("X8")?

an example of what I'm talking about in C#:

using System;
using System.Globalization;

public class Example

{
   public static void Main()

   {
    int value;
    value = 0x2045e;
    Console.WriteLine(value.ToString("x"));
    Console.WriteLine(value.ToString("X"));
    Console.WriteLine(value.ToString("X8"));

    value = 123456789;
    Console.WriteLine(value.ToString("X"));
    Console.WriteLine(value.ToString("X2"));
  }
}

/* 
2045e
2045E
0002045E
75BCD15
75BCD15 
*/

Aucun commentaire:

Enregistrer un commentaire