Methodological Instructions
Theme: Use of strings
Aim: Use of procedures and functions for processing strings
Assessment criteria
Knowledge
· Know how to find Length of string
Understanding
· How to output the string array elements
Application
· Write code for processing the strings using functions
· Write code for processing the strings using procedures
Language objectives
Student is able to describe an array of string.
For instance, foreach loop operator is used to work with string array elements.
Also, student can justify the purpose of function or procedure used for processing string.
Vocabulary and terminology specific to the subject:
String element, string array, foreach
Useful expressions for dialogs and letters:
Well, to work with array of strings … .
For example, each element of string array … .
As a matter of fact, the stings are used in the wide variety of cases to … .
Content (practical)
static void strLength(string s)
{
int len = s.Length;
Console.WriteLine(len);
}
static void Main(string[] args)
{
string s1 = "Computer";
strLength(s1);
Console.ReadLine();
}
|
Procedure |
Function |
|
static void strLength(string s) { int len = s.Length; Console.WriteLine(len); } static void Main(string[] args) { string s1 = "Computer";
strLength(s1);
Console.ReadLine();
}
|
static int strLength(string s) { int len = s.Length; return len; }
static void Main(string[] args) { string s1 = "Computer"; int strLen=strLength(s1); Console.WriteLine(strLen); Console.ReadLine(); } } |
Array of strings
static void strArr(string[] dat)
{
foreach (string value in dat)
{
Console.WriteLine(value);
}
}
static void Main(string[] args)
{
string[] data = { "Altyn", "Bolat", "John" };
strArr(data);
Console.ReadLine();
}
П. Questions for self-assessment.
What is the difference of procedure and function?
How the loop operator Foreach functions?
Visual Aids and Materials links.
1. Slides
2. https://www.dotnetperls.com/array
Students' Practical Activities:
Students must be able:
· Write code for processing the strings using functions
· Write code for processing the strings using procedures
Скачано с www.znanio.ru
Материалы на данной страницы взяты из открытых источников либо размещены пользователем в соответствии с договором-офертой сайта. Вы можете сообщить о нарушении.