rendered paste body
#include <iostream.h>
int main() {
string line, str2, word2;
char ch;
int sent, word, upper;
int words;
int i;
int largest, smallest;
cout << "CSE 1020 Program 5 Christen Sanford ces0152@unt.edu" << endl;
cout << "Please enter a series of lines:" << endl;
sent=0;
word=0;
words=0;
upper=0;
while (getline(cin,line)) {
for( i=0; i < line.length(); i++) {
if (line[i] == ' ') {
words++;
}
if (line[i] == '.' || line[i] == '?' || line[i] == '!') {
sent++;
}
if (line[i] >= 'A' && line [i] <= 'Z') {
upper++;
}
largest=0;
smallest=0;
word2=line.substr(0,line.find(' ', 0);
if (word2.length() >= largest)
word2=largest;
else if (word2.length() <= smallest)
word2=smallest;
}
}
words++;
cout << "There were " << sent << " sentences entered." << endl;
cout << "There were " << word << " words entered." << endl;
cout << "There were " << upper << " upper case words entered." << endl;
cout << "The largest word is " << largest << endl;
cout << "The smallest worde is " << smallest << endl;
return 0;
}