2_Computer Science Grade 10 String_manipulation presentation 1 2variant

  • ppt
  • 02.05.2020
Публикация на сайте для учителей

Публикация педагогических разработок

Бесплатное участие. Свидетельство автора сразу.
Мгновенные 10 документов в портфолио.

Иконка файла материала 2_Computer Science Grade 10 String_manipulation presentation 1 2variant.ppt

String manipulation

Learning objective

10.4.1.2 use procedures and functions for string manipulation

Vocabulary

English

Қазақ

Русский

Function

Функция

Procedure

Процедура

Value parameter

Сандық параметр

Числовой параметр

String

Жол

Строка

Character Strings

A sequence of characters is often referred to as a character “string”.
A string is stored in an array of type char ending with the null character '\0 '.

A string containing a single character takes up 2 bytes of storage.

Character Strings

Character Strings

Character Strings

Character vs. String

A string constant is a sequence of characters enclosed in double quotes.
For example, the character string:
char s1[2]="a"; //Takes two bytes of storage.
s1:

On the other hand, the character, in single quotes:
char s2= `a`; //Takes only one byte of storage.
s2:

a

\0

a

Character vs. String

Task 1

Answer the questions using Internet resources (videos, texts, images):
How to describe a string?
How to input a string?
How to output a string?


10

Descriptors:
Student
correctly writes the describe string function;
correctly writes the input string function;
correctly writes the output string function.

Example 1

char message1[12] = "Hello world";
cout << message1 << endl;

message1:


char message2[12];
cin >> message2; // type "Hello" as input

message2:

Example 2: String I/O

String can be input using the extraction operator >>, but one or more white spaces indicates the end of an input string.
char A_string[80], E_string[80];
cout << "Enter some words in a string:\n";
cin >> A_string >> E_string;
cout << A_string << E_string
<< “\nEND OF OUTPUT\n";

Output:
Enter some words in a string:
This is a test.
Thisis
END OF OUTPUT

Task 2

Watch the video and write the functions for string manipulation.

13

Descriptors:
Student
correctly writes the string functions;
correctly describes their purpose.

Video

14

Task 3

Write a program to the first task of other group students.

15

Descriptors:
Student
- correctly writes the string functions;
- correctly writes a procedure and the main program.

Task 4

Write a program to the second task of other group students.

16

Descriptors:
Student
- correctly writes the string functions;
- correctly writes a procedure and the main program.

Reflection

17