: . . ListBox. , . Label.
:
. 1.1.
.
private void button1_Click(object sender, EventArgs e)
{
//
int index = listBox1.SelectedIndex;
// str
string str = (string)listBox1.Items[index];
//
int len = str.Length;
// , 0
int count = 0;
// 0
int i = 0;
//
while (i < len - 1)
{
// ,
// 1
if (str[i] == ' ')
count++;
i++;
}
label1.Text = " = " +
count.ToString();
}
ListBox. Label. Form, .
1. , . .
2. .
3. .
4. . , .
5. , , . .
6. .
7. . , .
8. . , .
9. , , . .
10. , , . .
11. , , . i - j - . i j .
12. , , . .
13. , , . +.
14. , . *.
15. , . , , .. , (, ).
|
|
16. , , . , .
17. . , .
18. , , . , .
19. , , . .
20. , . .
21. . .
22. , , .
23. , .
24. , , :
.
25. , , . , .