|
[C#] Char array - Basic Example
|
|
04-03-2010, 08:56 AM
(This post was last modified: 04-03-2010 09:28 AM by Back_track.)
Post: #1
|
|||
|
|||
|
[C#] Char array - Basic Example
Code: /*"Character is determined more by the lack of certain experiences than by those one has had." Friedrich Nietzsche |
|||
|
04-03-2010, 08:59 AM
Post: #2
|
|||
|
|||
|
RE: [C#] Char array - Basic Example
Not bad, imo an example should be commented as much as possible to help the reader. Also are character arrays really needed in C#, why not just use string?
Good job on it though
|
|||
|
04-03-2010, 09:25 AM
Post: #3
|
|||
|
|||
|
RE: [C#] Char array - Basic Example
I'll go though and add some comments, i just thought char arrays are just a good introduction to some parts of programming so .. i made this
"Character is determined more by the lack of certain experiences than by those one has had." Friedrich Nietzsche |
|||
|
04-03-2010, 12:17 PM
Post: #4
|
|||
|
|||
|
RE: [C#] Char array - Basic Example
Much better!
Like it now! Yes char/arrays are very important parts of programming and a good way of learning about data types and memory.
|
|||
|
04-03-2010, 06:32 PM
Post: #5
|
|||
|
|||
|
RE: [C#] Char array - Basic Example
Very good example. On even positions are "x" characters and on odd "y".
Instead of "Int32.Parse" you could use "Convert.ToInt32" but that is the same. Very good example ! There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
04-05-2010, 06:44 AM
Post: #6
|
|||
|
|||
|
RE: [C#] Char array - Basic Example
Found a better way to find the odds than the else statement
Code: if((i%2) != 0)"Character is determined more by the lack of certain experiences than by those one has had." Friedrich Nietzsche |
|||
|
04-05-2010, 07:00 AM
Post: #7
|
|||
|
|||
RE: [C#] Char array - Basic Example
(04-05-2010 06:44 AM)Back_track Wrote: Found a better way to find the odds than the else statementOr i think that odd number is if it is equal to 1 like : Code: if((i%2) == 1)There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
04-05-2010, 07:18 AM
Post: #8
|
|||
|
|||
|
RE: [C#] Char array - Basic Example
Good old modulus!
|
|||
|
08-25-2010, 08:49 PM
Post: #9
|
|||
|
|||
|
RE: [C#] Char array - Basic Example
I don't quite get the purpose. Incidentally
Code: char[] text = Console.ReadLine().ToCharArray();Poor code, 't is poor. |
|||
|
« Next Oldest | Next Newest »
|






![[Image: pgsig copy.png]](http://projectghostt.com/images/pgsig copy.png)