0

Hi, I'd like to have tabs in my console app, but instead of using \t, I'd like to use an equivalent of the C++ setw() method in C#. Any ideas of what I might use?

And another thing, in C++, you would declare more than one array with indexes like this:

int x[10], y[10], z[10];

Is there a shorter way than writing like this in C# :

int[] x = new int[10];
int[] y = new int[10];
int[] z = new int[10];

Thanx for the help, if someone knows.

Edit: Oh, damnit, wrong forum! Can a mod move it to the C# forum?

4
Contributors
4
Replies
8
Views
13 Years
Discussion Span
Last Post by r0ckbaer
0

Hey there silkfire,

On the array question, do you need three distinct arrays? You could create a multidimensional array, like a jagged array:

int [][][] njaggedArray = new int [10][10][10];

Will that work?

1

setw() equiv would be sth like this:

String.Format("{0,10:D}", 2) : will format number 2 as a string of width 10 aligned to the right, use -10 to have it aligned on the left

as for declaring the vars, you can do it like this:

int[] a, b, c = new int[10];

Votes + Comments
Good info
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.