Menu
Coddy logo textTech

Total Characters

Lesson 3 of 5 in Coddy's Simple Character Counter using C++ course.

challenge icon

Challenge

Easy

Now, you have the user's input, count the number of characters in the string and output it like this (with a new line):

Total characters: XX

Exclude spaces.

Delete the output of user's input from previous lesson.

Try it yourself

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

int main() {
    string text;

    cout << "Enter text:" << endl;
    getline(cin, text);

    cout << text;
    return 0;
}

All lessons in Simple Character Counter using C++