المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Need help on how to loop through the following code to find the nearest number above in comparison to another



C# Programming
03-11-2010, 03:37 PM
Hi,

This is my code.

I'm a newbie to c# and I have been working on this for a few days.

{
readText = File.ReadAllText("C:\\PIn.txt");

string [] split = readText.Split(new Char [] {' '});

int splitCounter = 0;

foreach (string s in split)
{
splitCounter++;

if (splitCounter == 1)
bn1 = double.Parse(s);

if (splitCounter == 2)
bn2 = double.Parse(s);

if (splitCounter == 3)
bn3 = double.Parse(s);

if (splitCounter == 4)
bn4 = double.Parse(s);
}
Print("Pn: " + pn1 + " " + pn2 + " " + pn3 + " " + pn4);

As you can see I've used Print to make sure it is working but I am having a huge amount of trouble moving forward...please help. It's an important step for me.

Regards,
suprsnipes