Menu
Coddy logo textTech

Count Alphabetic Letter

Lesson 11 of 18 in Coddy's Functions in C++: Building Your Own Functions course.

challenge icon

Challenge

Easy

Write a function to count characters in a given string.



The function count_characters takes a string (arrays of characters), checks the characters, and counts them.

 

Example:

  • If the input is <strong>“Coddy2024”</strong>
  • The output will be <strong>5</strong>.

Try it yourself

#include <iostream>
#include <string>   
using namespace std;

int countCharacters(string str) {
    
    
}

All lessons in Functions in C++: Building Your Own Functions