Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

\"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();
}

Explanation / Answer

please rate - thanks I had to change your code a bit to use strings, not characterarrays. (note the hint you were given) also you don't count lines,(let me know if you need hep with that,but this has the answer to part 2 color code : yellow commented out, blue changedfor my compiler, red changed or added for the answer #include #include #include #include using namespace std; int main() { int i=0,len=0,words=0,lines=0,position; //char str1[100]; //clrscr(); string str1; cout