NOTE: DO NOT delete nor change the code already given to you in the code template, except for the comments /* REPLACE THIS COMMENT WITH YOUR VARIABLES */ and /* REPLACE THIS COMMENT WITH YOUR CODE */. You will insert your solution by replacing these two comments. TASK 3: Write C++ code using the while statement to repeatedly read a sequence of characters from the user using the cin statement until the user enters a period (.) or exclamation mark (!). TASK 4: Write C++ code to count the number of vowels, consonants, and other characters. TASK 5: Write C++ code to display statistics using the counts computed in TASK 4. Be sure that there is a comment documenting each variable (see the document on Carmen under Modules on how to comment your code). Do not start a variable name with a capital letter. Be sure that your code is properly indented, readable, and use good descriptive names. Test your solution.     #include using namespace std; int main() { char character; /* REPLACE THIS COMMENT WITH YOUR VARIABLES */ cout << "Enter text:" << endl; cin >> character; /* REPLACE THIS COMMENT WITH YOUR CODE */ return 0; }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

NOTE: DO NOT delete nor change the code already given to you in the code template, except for the comments /* REPLACE THIS COMMENT WITH YOUR VARIABLES */ and /* REPLACE THIS COMMENT WITH YOUR CODE */. You will insert your solution by replacing these two comments.

TASK 3: Write C++ code using the while statement to repeatedly read a sequence of characters from the user using the cin statement until the user enters a period (.) or exclamation mark (!).

TASK 4: Write C++ code to count the number of vowels, consonants, and other characters.

TASK 5: Write C++ code to display statistics using the counts computed in TASK 4.

  • Be sure that there is a comment documenting each variable (see the document on Carmen under Modules on how to comment your code).

  • Do not start a variable name with a capital letter. Be sure that your code is properly indented, readable, and use good descriptive names.

  • Test your solution.

 

 


#include <iostream>

using namespace std;

int main()
{

char character;
/* REPLACE THIS COMMENT WITH YOUR VARIABLES */

cout << "Enter text:" << endl;
cin >> character;

/* REPLACE THIS COMMENT WITH YOUR CODE */

return 0;
}

Test 1
> run
Enter text:
Your sentence has 0 letter (s).
Number of a's: 0
Number of e's: 0
Number of i's: 0
Number of o's: 0
Number of u's: 0
Number of consonants: 0
Number of other characters: 0
Vowels make up 0% of the sentence.
Test 2
> run
Enter text:
!
Your sentence has 0 letter(s).
Number of a's: 0
Number of e's: 0
Number of i's: 0
Number of o's: 0
Number of u's: 0
Number of consonants: 0
Number of other characters: 0
Vowels make up 0% of the sentence.
Transcribed Image Text:Test 1 > run Enter text: Your sentence has 0 letter (s). Number of a's: 0 Number of e's: 0 Number of i's: 0 Number of o's: 0 Number of u's: 0 Number of consonants: 0 Number of other characters: 0 Vowels make up 0% of the sentence. Test 2 > run Enter text: ! Your sentence has 0 letter(s). Number of a's: 0 Number of e's: 0 Number of i's: 0 Number of o's: 0 Number of u's: 0 Number of consonants: 0 Number of other characters: 0 Vowels make up 0% of the sentence.
Test 9
> run
Enter text:
Equation 5 * 3
- 2 / (3 % 5).
Your sentence has 19 letter(s).
Number of a's: 1
Number of e's: 1
Number of i's: 1
Number of o's:
1
Number of u's: 1
Number of consonants: 3
Number of other characters: 11
Vowels make up 26.32% of the sentence.
Test 10
> run
Enter text:
You passed the final test :) AWESOME.
Your sentence has 30 letter(s).
Number of a's: 3
Number of e's: 5
Number of i's:
1
Number of o's: 2
Number of u's: 1
Number of consonants: 16
Number of other characters: 2
Vowels make up 40.00% of the sentence.
Transcribed Image Text:Test 9 > run Enter text: Equation 5 * 3 - 2 / (3 % 5). Your sentence has 19 letter(s). Number of a's: 1 Number of e's: 1 Number of i's: 1 Number of o's: 1 Number of u's: 1 Number of consonants: 3 Number of other characters: 11 Vowels make up 26.32% of the sentence. Test 10 > run Enter text: You passed the final test :) AWESOME. Your sentence has 30 letter(s). Number of a's: 3 Number of e's: 5 Number of i's: 1 Number of o's: 2 Number of u's: 1 Number of consonants: 16 Number of other characters: 2 Vowels make up 40.00% of the sentence.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY