Description: This program shows length of entered sentence without using any library function.
Code:
//Compiling Tool: Code::Block IDE with MinGW
//Program shows length of entered sentence without using any library function.
#include<iostream>
#include<stdio.h> //used for gets()
using namespace std;
int main()
{
char a[30];
int i;
cout<<"Enter a string:";
gets(a);
for(i=0;a[i]!='\0';++i);
cout<<"\nLength of the string '"<<a<<"' is "<<i;
return 0;
}
Output:
If you want to write or construct or program C++ mini-project and do not know how or from where to start buy this simple e-book: Code Review of 26 C++ mini-projects. For book sample click this link.
Add your comments in below available comment box.
Note: Click these label/tags to view all related posts. Tags: C++Code
…till next post, bye-bye & take care.
No comments:
Post a Comment