View the step-by-step solution to:

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. If the...

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. If the input is: n Monday, the output is 1. If the input is: z Today is Monday, the output is 0. If the input is: n It's a sunny day, the output is 2.

Case matters. If the input is: n Nobody, the output is 0. (n is different than N). Your program must define and call a function int CountCharacters(char userChar, string userString). The function should return the number of times the input character appears in the input string.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question