Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ please include screenshots 2. Using a for-loop. Write a program that asks the user for a string 's' and a char' then counts how

c++
please include screenshots
image text in transcribed
image text in transcribed
2. Using a for-loop. Write a program that asks the user for a string 's' and a char' then counts how many times 'e' appears in 's'. variable followed by a space, then output an asterisk (*) If the value of the for-loop counter variable Create a for-loop that cycles from 0 up to and including 20. On each iteration, output the counter is divisible by 2, an at symbol (@) if divisible by 3, and a dollar sign ($) if divisible by 4. The output of each iteration should be on a separate line. Note: Certain iterations may be divisible by more than one number. In such cases, you will have more than one symbol printed and separated by a space on that line. Sample output: $ 0 + @ $ 1 24 3 @ 4 5 6 @ 7 8 9 @ 10 * 11 12 * @ $ 13 14 15 @ 16 * $ 17 18 @ 19 20 * Hint: Make use of the modulus operator "%" (like we did in previous exercises) to determine if a number is divisible by 2, 3, or 4. For example, if I wanted to tell the user that a number is divisible by 2 then I could do something like: if (userInput % 2 = ) cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions