Generate Characters
Lesson 14 of 18 in Coddy's Functions in C++: Building Your Own Functions course.
Challenge
EasyWrite 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: 102Try it yourself
#include <iostream>
using namespace std;
void generate_characters(char start, char end) {
}
All lessons in Functions in C++: Building Your Own Functions
1Introduction
Introduction2Beginner-level function
Repeat a StringReverse a StringMax ValueFill stringCenter TextFormat TextMath Operation3Intermediate-level functions
Compare two StringsSwap CasesCount Alphabetic LetterReplace in ArrayExtracts Integers Generate CharactersDeletes Specific Index