4.16 LAB: Count characters Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string. The output should include the input character and use the plural form, n's, if the number of times the characters appears is not exactly 1. You may assume that the string does not contain spaces and will always contain less than 50 characters. Ex: If the input is: n Monday the output is: 1 n Ex: If the input is: z TodayisMonday the output is: 0 z's Ex: If the input is: n It's sunnytoday the output is: 2 n's Case matters. Ex: If the input is: n Nobody the output is: 0 n's n is different than N. 1 #include 2 #include 3 4 int main(void) { 5 6 7 8 9} 10 /* Type your code here. */ return 0; main.c Load default template...
4.16 LAB: Count characters Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string. The output should include the input character and use the plural form, n's, if the number of times the characters appears is not exactly 1. You may assume that the string does not contain spaces and will always contain less than 50 characters. Ex: If the input is: n Monday the output is: 1 n Ex: If the input is: z TodayisMonday the output is: 0 z's Ex: If the input is: n It's sunnytoday the output is: 2 n's Case matters. Ex: If the input is: n Nobody the output is: 0 n's n is different than N. 1 #include 2 #include 3 4 int main(void) { 5 6 7 8 9} 10 /* Type your code here. */ return 0; main.c Load default template...
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
Related questions
Question
![4.16 LAB: Count characters
Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the
string. The output should include the input character and use the plural form, n's, if the number of times the characters appears is not
exactly 1. You may assume that the string does not contain spaces and will always contain less than 50 characters.
Ex: If the input is:
n Monday.
the output is:
1 n
Ex: If the input is:
z TodayisMonday
the output is:
0z's
Ex: If the input is:
n It's sunnytoday
the output is:
2 n's
Case matters.
Ex: If the input is:
n Nobody
the output is:
0 n's
n is different than N.
1 #include <stdio.h>
2 #include <string.h>
3
int main(void) {
5
6
7
8
9}
10
/* Type your code here. */
return 0;
main.c
Load default template...](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2607c80f-78e3-4cea-850b-2b41054ecd85%2F539059df-940e-4766-a268-95dfc1648140%2Fp0ubnnh_processed.png&w=3840&q=75)
Transcribed Image Text:4.16 LAB: Count characters
Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the
string. The output should include the input character and use the plural form, n's, if the number of times the characters appears is not
exactly 1. You may assume that the string does not contain spaces and will always contain less than 50 characters.
Ex: If the input is:
n Monday.
the output is:
1 n
Ex: If the input is:
z TodayisMonday
the output is:
0z's
Ex: If the input is:
n It's sunnytoday
the output is:
2 n's
Case matters.
Ex: If the input is:
n Nobody
the output is:
0 n's
n is different than N.
1 #include <stdio.h>
2 #include <string.h>
3
int main(void) {
5
6
7
8
9}
10
/* Type your code here. */
return 0;
main.c
Load default template...
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning