Untitled

mail@pastecode.io avatar
unknown
c_cpp
19 days ago
507 B
0
Indexable
Never
#include <iostream>

void printEveryFourthLetter( const char* start )
{
    std::cout << "Co czwarta litera począwszy od drugiego elementu: ";

    for( int i = 0; start[ i ] != '\0'; i += 4 )
    {
        std::cout << start[ i ] << " ";
    }

    std::cout << '\n';
}

int main()
{
    char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    const char* ptr = alphabet + 1;

    std::cout << "Drugi element: " << *ptr << '\n';

    printEveryFourthLetter( ptr );

    return 0;
}
Leave a Comment