.


:




:

































 

 

 

 


9:




(Build). , Debug Start ( Start Without Debugging) . Web- Internet Explorer , , :

Principal: 100000

Rate: 10

Term: 240

Compute Payment. ' Monthly Payment = $965.02.

LoanCalc

LoanCalc WebForml.aspx WebForml.aspx.cs. LoanCalc. , Visual Studio.NET .

WebForml.aspx HTML. Visual Studio.NET Web- , # WebForml.aspx.cs. Visual Studio.NET. , , .

ASPX- HTML Web- , CS- 䳿 Click Compute Payment, , . , , , Web- , .

 

:

1. Visual Studio 2012?

2. ?

3. ASP.NET?

4. Toolbox?

5. WebForml.aspx?

6. WebForml.aspx.cs?

7. 㳿 ASP.NET. Web-.

 

2

WEB- Visual Studio2012.

, , #

: # Microsoft Visual Studio 2012. . , , ,

 

: Microsoft Visual Studio 2012 Web-, , ( #) . 1, 2 .

 

:

 

C#

 

, , '. ֳ , . C# ' . : , ' '.

:

[ ] _ = new [];

, ' 10 :

int[ ] array = new int[10];

, . CLR

, ( - , - , - false, - null). , .

C# , System.Array, ' . , Array ( ), '.

. . :

int[ ] array = new int[10];

............

array = new int[20];

, . new . :

int[ ] array = { 1, 2, 3, 4, 5 };

. . :

Int[ ] array = new int[5]{ 1, 2, 3, 4, 5 };

- , :

int[ ] array = new int[]{ 1, 2, 3, 4, 5 };

, . , .

int[ ] array = new int[5];

for (int i = 0; i < array.Length; i++)

array[i]= i;

, , , . , .

, string:

String[ ] st = new string[12];

, , , new. , : int[3] a={3,5,6};

C# , . , . , , "". , . , , "".

: :

Random rnd=new Random();

int[,] Matrix;

Matrix = new int[5, 4];

for (int i = 0; i < 5; i++)

for (int j=0;j<4;j++)

Matrix[i,j]= rnd.Next(10,99);

, :

for (int i = 0; i < 5; i++)

{

for (int j = 0; j < 4; j++)

{

Response.Write(Matrix[i, j].ToString());

Response.Write(" ");

}

Response.Write("<br/>");

}

"" , . :

Random rnd = new Random();

int[][] JMatrix = new int[5][];

for (int i = 0; i < JMatrix.Length; i++)

{

JMatrix[i]= new int[rnd.Next(1,7)];

}

ʳ . ʳ '. , , ( ). , .

for (int i = 0; i < JMatrix.Length; i++)

{

Response.Write("ʳ " +

i.ToString() + "=" + JMatrix[i].Length.ToString()+" ");

for (int j = 0; j < JMatrix[i].Length; j++)

{

Response.Write(JMatrix[i][j].ToString() + " ");

}

Response.Write("<br/>");

}

j Length.

Array

C# , . C# , Object.

Array - . ³ , C++ . , Array Object, Array , , , , . . Array:

 

BinarySearch()
Sort()
Clear()
CopyTo()
GetLength(), Length
GetLowerBound()
GetUpperBound()
GetValue()
SetValue()
Reverse()
Rank

 

Array. .

myArray Page, int:

static Array myArray = Array.CreateInstance(typeof(Int32), 6);

TextBox Button, tb_value btn_find .

, , . .

protected void btn_find_Click(object sender, EventArgs e)

{

Random rnd = new Random();

Response.Write(" <br/>");

for (int i = myArray.GetLowerBound(0); i <=

myArray.GetUpperBound(0); i++)

{

myArray.SetValue(rnd.Next(1, 10), i);

Response.Write(myArray.GetValue(i) + "\t");

}

Response.Write("<br/>");

Array.Sort(myArray);

Response.Write("ϳ :<br/>");

for (int i = myArray.GetLowerBound(0); i <=

myArray.GetUpperBound(0); i++)

{

Response.Write(myArray.GetValue(i) + "\t");

}

object = Convert.ToInt32(tb_value.Text);

int findIndex = Array.BinarySearch(myArray, );

if (findIndex<0)

{

Response.Write("<br/> ");

}

else

{

Response.Write("<br/> <b>"+findIndex.

ToString()+"</b>");

}

}

.2.1.

 

. 2.1 ,

 

, C# , Array.

C#

㳿 C# System.String, , . String .

Length .
Concat() ' object.
CompareTo() . . , .
Copy() .
Format()   ( ) {0}.
Insert() .
Remove() Replace() .
ToUpper() ToLower() .
Chars , .
Join() , -.
Replace() .
Split() - , -.
Substring() , .
Trim() .
ToCharArray() .

 

C# . String . , , ', ', '. , "+" ' string , Concat().

.

 

 

1

MakeLin, , , . . , sArr . ϳ , , , Join, sArr ' :

protected void Page_Load(object sender, EventArgs e)

{

Response.Write(MakeLine(0, 5 ", "));

Response.Write("</br>");

Response.Write(MakeLine(1, 6 " "));

Response.Write("</br>");

Response.Write(MakeLine(9, 9 ": "));

Response.Write("</br>");

Response.Write(MakeLine(4, 7, "< "));

}

private static string MakeLine(int initVal, int multVal, string sep)

{

string[] sArr = new string[10];

for (int i = initVal; i < initVal+10; i++)

sArr[i-initVal]= String.Format("{0-3}", i * multVal);

return String.Join(sep, sArr);

}

.2.2.

 

 

.2.2 Join

 

, -.

2

 

, -. Split , . - . Trim, , , .

string words = ", ,

: .";

string [] split = words.Split(new Char [] {' ', '',, '.' ':'});

foreach (string s in split)

{

if (s.Trim()!= "")

Response.Write(s+"</br>");

}

ϳ , . 2.3.

 

 

. 2.3 Split





:


: 2016-11-18; !; : 363 |


:

:

, - , ; , - .
==> ...

1636 - | 1639 -


© 2015-2024 lektsii.org - -

: 0.074 .