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

Respuesta :

Answer:

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.

ACCESS MORE