Menu
Coddy logo textTech

Generate Characters

Lesson 14 of 18 in Coddy's Functions in C++: Building Your Own Functions course.

challenge icon

Challenge

Easy

Write a function to generate characters from a given start position to an end position.


The function generate_characters should take two arguments:

  • The first character specifies the starting position.
  • The second character specifies the ending position.
     

The function will generate all characters between the two input characters (inclusive) along with their ASCII codes.

Example:
If the start character is “a” and the end character is “f”, the output will be:

a: 97
b: 98
c: 99
d: 100
e: 101
f: 102

Try it yourself

#include <iostream>

using namespace std;

void generate_characters(char start, char end) {
   
}

All lessons in Functions in C++: Building Your Own Functions