The kids need to clear a simple test to secure admission in the nursery class. They need to spell their name and they also need to tell the number of letters in their name. Some of the kids had very long names and the interview panel members found it time-consuming to count the number of letters in the name. One of the panel members has just started to learn programming and she decided to write a C++ program to count the number of charaters in the name. She knew that it was an easy task as the good old strlen function is availabe in C++. Can you help her out in this task? Write a C++ program to find the number of characters in the string.
Answers
Answered by
2
Answer:
you want to answer the questions by me
Answered by
5
Answer:
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
char str[100];
int i=0; int l=0;
cin>>str;
while(str[i]!='\0')
{
l++;
i++;
}
cout<<"The number of letters in the name is "<<l;
return 0;
}
Explanation:
Similar questions