Skip to content

Pro Programming

Professional way of Programming

  • Home
  • C MCQs
  • C/C++
  • Java
  • Python
  • MySQL
  • Online Compiler
  • Topics
    • Arrays
    • Strings
    • Link Lists
    • Trees
    • Shapes
    • Articles
    • Games
    • Projects

Program to Find length of String C++

This is a simple program to find Length of a String in C++.

Just traverse the string till NULL (‘’), increment the ‘i’ likewise.

Program to Find length of a String C++

#include<iostream>
using namespace std;

int main( )
{
    int i;
    char str[80];
    cout<<"Enter a string:";
    gets(str);

    for(i=0;str[i]!='';i++);

    cout<<"Lenght of string is :"<<i;

    return 0;
}

 

OUTPUT:

length of string in C++

Related Posts:

  • Find length of the longest sub-sequence in C++
  • C MCQs: Variable Length Arguments- Part 1
  • C MCQs: Variable Length Arguments- Part 2
  • Java String to String Array Example
  • Python program to check if String is Palindrome or not
  • Java Program to Display String in Rectangle
  • Java Convert int Array To String Example
  • Java Reverse String Array Example
  • Java Sort String Array Example
  • Java Stacktrace to String Example
  • Java Date to String Example
  • Java Character Array To String Example
  • Java String Array Contains Example
  • Count pairs of non-overlapping palindromic sub-strings of the given string
  • Number of substrings of binary string containing K ones
Categories string
Post navigation
Rotate Image by 90 degree in C++
Program to check whether String is palindrome or not C++

Leave a Comment Cancel reply

Must See Content

  • Find length of the longest sub-sequence in C++
  • C MCQs: Variable Length Arguments- Part 1
  • C MCQs: Variable Length Arguments- Part 2
  • Java String to String Array Example
  • Python program to check if String is Palindrome or not
  • Java Program to Display String in Rectangle
  • Java Convert int Array To String Example
  • Java Reverse String Array Example
  • Java Sort String Array Example
  • Java Stacktrace to String Example

Recent Comments

  • David Bolton on Last Minute Notes: C and C++
  • Alisha Ross on Some mind blowing facts about Computers
  • Binary Search Tree implementation in C++ - Pro Programming on Program to check if Tree is Binary Search Tree C++
  • C++ program to implement AVL Tree - Pro Programming on Red Black-Tree(RB-Tree) implementation in C++
  • Program to Find Perfect Number in Python - Pro Programming on Program to find Perfect Number Program in C++
  • Email
  • Facebook
  • Twitter

Related Posts:

  • Find length of the longest sub-sequence in C++
  • C MCQs: Variable Length Arguments- Part 1
  • C MCQs: Variable Length Arguments- Part 2
  • Java String to String Array Example
  • Python program to check if String is Palindrome or not
  • Java Program to Display String in Rectangle
  • Java Convert int Array To String Example
  • Java Reverse String Array Example
  • Java Sort String Array Example
  • Java Stacktrace to String Example

Recent Posts

  • How to use MySQLDump effectively for backups
  • Top 10 Games for Beginners to learn programming the easy way
  • A simple Zombie War Game in C++
  • Mobile Numeric Keypad Problem: Solution in C++
  • Last Minute Notes: C and C++
  • JavatPoint Offline version Download Free
  • How to count number of non repeating digits in a Range C++
  • C++ Program to check if word exists in Grid or not
  • Top Cryptocurrency list of 2021
  • C Program to Implement Coppersmith Freivald’s Algorithm
© 2020 | ProProgramming | About | Contact US | Privacy Policy