The MSDN documentation for "Read" might help here...
http://msdn2.microsoft.com/en-us/library/system.console.read.aspx What you'll need to do is read in the console input as a string and use Convert.ToInt32() (or whatever) to get the input value. Alan. On 6/28/07, Paul F. Johnson <[EMAIL PROTECTED]> wrote:
Hi, Got a bit of a strange one which I'm not sure about. Below is a bit of code I'm playing with... namespace bitcount { public bitcount { private uint BitCounter(uint u) { uint uCount; uCount = u - ((u >> 1) & 033333333333) - ((u >> 2) & 011111111111); return (uCount + (uCount >> 3) & 030707070707 % 63; } public static void Main { bitcount bc = new bitcount(); uint number; Console.WriteLine("Please enter a number "); number = Console.Read(); number = BitCounter(number); Console.WriteLine(number); Console.ReadKey(); } } } Okay, it won't compile (Read is static int for a start), but the oddest piece of the puzzle is that the uint variables cause problems when I try to compile (casting). If I change everything to long, the value returned is incorrect (if you re-write this in C or C++ and enter 85, it returns 2, in C# it returns 33). Any clues as to why this behaviour is seen? It makes no difference if I target mono or VS.NET. TTFN Paul -- Get your free @ukpost.com account now http://www.ukpost.com/ _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list