\"Read a passage of100 characters from user in a character arrayand #include<ios
ID: 3609333 • Letter: #
Question
"Read a passage of100 characters from user in a character arrayand
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,len=0,words=0,lines=0;
char str1[100];
clrscr();
cout<<"Enter a string (100 Characters Max. PressEnter to terminate) : ";
for(i=0;(int)str1[i-1]!=13;i++)
{
str1[i]=getche();
len++;
}
cout<<endl<<endl;
for(i=0;i<len;i++)
{
if((int)str1[i-1]!=32 && (int)str1[i]==32)
words++;
else if((int)str1[i]==46)
lines++;
}
cout<<endl<<"Words:"<<words+1<<endl<<"Lines:"<<lines;
cout<<endl;
getch();
}