This is a C++ program that uses the string class to create a string containing all the letters of the alphabet, and then prints the length of the string.
The string class is part of the standard C++ library, and provides a convenient way to work with strings of characters. In this program, the string word is initialized with the letters of the alphabet. The length() function is then called on the word string, which returns the number of characters in the string. This value is then printed to the console using the cout object.
Overall, this program simply demonstrates how to use the string class and its length() function in C++ to get the length of a string.
#include<iostream> #include<string.h> using namespace std; int main() { string word = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; cout<<"\nThe length of the word string is: "<<word.length(); return 0; }To download raw file Click Here
The length of the word string is: 26
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions