[Mono-list] Doubt on "Console.ReadLine()" !!!!!
nsharath
sharath.05131a0584 at gmail.com
Fri Feb 13 04:10:35 EST 2009
hello sir,
I am working on SUSE studio MONO 2.2.
I am able to run the "Console.WriteLine()" perfectly.
But the "Console.ReadLine()" is showing exceptions in the sample code.But
this code is running perfectly on the Windows Visual studio 2008.
My doubt is : "HOW TO READ INPUT FROM USER" ??????
- - - - - - - - - - - - - SAMPLE CODE TO FIRST THE HIGHEST 2 NUMBERS IN
GIVEN ARRAY - - - - - - - -
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace practice
{
class highest
{
public static void Main()
{
int n,first,second;
Console.Write("enter size of array:");
n = Int32.Parse(Console.ReadLine());
int[] a = new int[n];
for (int i = 0; i < a.Length; i++)
{
Console.Write("enter number{0}:", (i+1));
a[i] = Int32.Parse(Console.ReadLine());
}
Big_func(a, out first, out second);
Console.WriteLine("FIRST HIGHEST = " + first);
Console.WriteLine("SECOND HIGHEST = " + second);
}
public static void Big_func(int[] a, out int first, out int second)
{
first = 0;
second = 0;
foreach(int i in a)
{
if (i > first)
{
second = first;
first = i;
}
else if (i > second && i < first)
{
second = i;
}
}
}
}
}
- - - - - - - - - - - - - the end - - - - - - - -
--
View this message in context: http://www.nabble.com/Doubt-on-%22Console.ReadLine%28%29%22-%21%21%21%21%21-tp21992667p21992667.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list