Ok next time I have to format your code or change void main() to int main() I will not help you
Code:
#include<iostream.h>
#include<string>
int main()
{
char str1[44];
int i=0;
int j=0;
int counterwords =1;
cout<< "Please input your text string... \n";
cin>> str1;
while (str1[i] != 0)
{
i++;
if (str1[i] == ' ')
{
counterwords++; // how many words we have here
}
if (str1[i] != ( ' '|| ',' || ';' || '.' ||'!' || '?' ))
{
j++;// how many charactors that the lines have
}
}// while
int ave =0;
ave = j/ counterwords ;// what is the avarage of the words in this line...
cout<< " the number of words that you have intered is :" << counterwords<<endl;
cout<< "the number of the char that you have is :"<< j<< endl;
cout<< " the avarage of the word lingth is :" << ave << endl;
cout<< endl;
cout<< endl;
cout<< "take care";
return 0;
}
This does stil not give you the right answears but thats a logical thing with your algoritm. Think about it for awhile