Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C#

C#

Scheduled Pinned Locked Moved C#
csharpc++question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    r kh
    wrote on last edited by
    #1

    what is equivalent of setw()in C# setw() is in C++

    A N 2 Replies Last reply
    0
    • R r kh

      what is equivalent of setw()in C# setw() is in C++

      A Offline
      A Offline
      Alex Manolescu
      wrote on last edited by
      #2

      Example: In C you write:

      int x=1;
      cout << "Number:" << setw(20) << x << endl;

      In C# you write:

      int x=1;
      Console.WriteLine(String.Format("{0:D}", x).PadLeft(20));

      Cheer's, Alex Manolescu

      L 1 Reply Last reply
      0
      • A Alex Manolescu

        Example: In C you write:

        int x=1;
        cout << "Number:" << setw(20) << x << endl;

        In C# you write:

        int x=1;
        Console.WriteLine(String.Format("{0:D}", x).PadLeft(20));

        Cheer's, Alex Manolescu

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Or Console.WriteLine("{0,20}", x)

        1 Reply Last reply
        0
        • R r kh

          what is equivalent of setw()in C# setw() is in C++

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          How to get an answer to your question[^] Pay attention to #3. C# as the subject for a post in the C# forum is ridiculous and lazy.


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups