Q:

Write C++ program to find string length

belongs to collection: C++ language string programs

0

Write C++ program to find string length

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.

#include <iostream>
using namespace std;
 
int main()
{
    string str = "Tech Study";
 
    // you can also use str.length()
    cout << "String Length = " << str.size();
 
    return 0;
}

Result:

String Length = 10

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write C++ program to convert a string to lower cas... >>
<< Write C++ program to concatenate two strings...