Kat H.

asked • 04/19/21

Counting 3. Write a program that reads in two chars, like B and F and prints all the characters in that range in the format:

Write a program that reads in two chars, like B and F and prints all the characters in that range in the format:

B,C,D,E,F

Hints:

  1. Your loop variable should be a char. Remember you can add one to a char and store it back into itself to increment it. And that you can compare chars using ==, <=, < etc...
  2. You can use an if to figure out whether or not to print a ",", but it is easier to print either the first or last letter outside the loop and always print "," inside the loop

Code:


#include <iostream>

using namespace std;


int main()

{

//YOUR_CODE

}

1 Expert Answer

By:

Patrick B. answered • 04/20/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.