15,916,951 members
See more:
Hi! First of all thank you to all who replied to my earlier question.Moreover I want to say sorry to everyone whom i replied with rude comments that "I was not screaming" , actually I did not Know that words in capital means to scream.
Ques
Actually I wanted to print series like
aa
ab
ac
...
I am now able to print till end of combinations of first two letters using for loop.
Is there any way to move on to three combinations using for loop.

Thanks in advance and sorry for my previous rude replies.

What I have tried:

```#include<iostream>

using namespace std;

int main()
{

char a = 'a';
string b[26];
string c[7500];
int e;
int i;
int f = 0;
for(i=0;i<=25;i++)
{
b[i] = a++;
}
while(1)
{

for(int e=0;e<=26;e++)
{
c[e] = b[f]+b[e];
cout<<c[e]<<endl;
if(e==26)
{
f++;
}
}
if(f==26)
{
break;
}
}
getchar();
return 0;

}```
Posted
Updated 21-May-17 6:37am

## Solution 1

Why are you using numbers, when the language allows you to use letters just the same:
C++
```for (char c1 = 'a'; c1 <= 'z'; ++c1)
{
cout << c1 << endl;
}```

So to print multiple character combinations, you just need to add new loops inside the first one, thus:
C++
```for (char c1 = 'a'; c1 <= 'z'; ++c1)
{
for (char c2 = 'a'; c2 <= 'z'; ++c2)
{
for (char c3 = 'a'; c3 <= 'z'; ++c3)
{
cout << c1 << c2 << c3 << endl;
}
}
}```

v2