Lesson 4


Task 0

Create a new variable of type char*. Show the text on console.

#include <iostream>
#include <cstring>

int main()
    // easiest way
    char *c = "this is a text";

    // acceptable by standard
    char *cc = new char[100];
    strcpy(cc, "this is a text");

    // todo: display the text

    delete[] c;
    delete[] cc;
Task 1

Write a method that takes a pointer to a text and returns its length.

Task 2

Write a method, which takes a pointer to text and returns a new pointer to a copy.

Task 3

Write a methods that checks if a text is a palindrome.

Task 4

Write a method calculating count of words.

Task 5

Write a method, which inverts a given text.

Task 6

Write a method that replaces given word to another (we need to pass 3 texts as arguments).