hi all
I think im on the last leg of my poject here. I created a program to take a number and convert it into two "random" points that can be converted back to text later
the problem that im running into is that it works for short numbers (i havent finished the text to number part) so i can get about 7 digits in and then it will crash out
another problem i get is when i output numbers by useing the .tostring() i have been getting Scientific notation for output and i just need straight numbers
anyone know how to turn something like that off?
vb Code:
Random random = new Random(); float X1, X2, X3, Y1, Y2, Y3; //STEP3 MAKE RANDOM PNT1 X1 = random.Next(2,10000); Y1 = random.Next(2,10000); //STEP2 MAKE PNT2 WITH CONSTANT ( FROM TEXT BOX) X2 = Convert.ToInt64(textBox7.Text); Y2 = 0; X3 = 1; Y3 = 1; //STEP4 GET SLOPE FROM PNT1 AND PNT2 float slope = (Y2 - Y1) / (X2 - X1); float t = random.Next(2,10000); //STEP5 GET RANDOM POINT ALONG LINE MADE PNT1 AND PNT2 X3 = t + X2; Y3 = t * slope + Y2; //float p = random.Next(1); // X3 = X1+(1-p)*X2; // Y3 = p * Y1 + (1 - p) * 2; //OUTPUT TO TEXTBOX textBox5.Text = t.ToString(); textBox6.Text = slope.ToString(); textBox1.Text = X1.ToString(); textBox2.Text = Y1.ToString(); textBox3.Text = X2.ToString(); textBox4.Text = Y2.ToString(); textBox9.Text = X3.ToString(); textBox8.Text = Y3.ToString();




Reply With Quote