Ask Question
24 August, 05:44

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. 24 August, 05:50
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers