Ask Question
30 April, 01:01

Given an char variable last that has been initialized to a lowercase letter, write a loop that displays all possible combinations of two letters in the range 'a' through last. The combinations should be displayed in ascending alphabetical order: For example, if last was initialized to 'c' the output should be aa

+5
Answers (1)
  1. 30 April, 03:44
    0
    for (char i='a'; i<='e'; i++) {

    for (char j='a'; j<='e'; j++) {

    cout << i<< j<< "/n";

    }

    }

    Explanation:

    The loop runs all characters from the inner while the outer holds one character, by doing so, a will be matched with a, b, c, ... Like wise b, c, d, ... and on it goes.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Given an char variable last that has been initialized to a lowercase letter, write a loop that displays all possible combinations of two ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers