#include <iostream>
#include 
<string>
using namespace std;

char strSets[10][5= 
{
    
"",
    
"",
    
"abc",
    
"def",
    
"ghi",
    
"jkl",
    
"mno",
    
"pqrs",
    
"tuv",
    
"wxyz"
}
;

int count[10= {0033333434};

void Display1(int num[], int counts)
{
    
int index[10= {0};
    
while(true)
    
{
        
int i;
        
for(i = 0; i < counts; i++)
            cout
<<strSets[num[i]][index[i]];
        cout
<<endl;

        
int temp = counts - 1;
        
while(temp >= 0)
        
{
            
if(index[temp] < count[num[temp]] - 1)
            
{
                index[temp]
++;
                
break;
            }

            
else
            
{
                index[temp] 
= 0;
                temp
--;
            }

        }

        
if(temp < 0)
        
{
            
break;
        }

   
    }

}
;

void display2(int num[], int temp[], int index, int counts)
{
    
if(counts == index)
    
{
        
int i;
        
for(i = 0; i < counts; i++)
            cout
<<strSets[num[i]][temp[i]];
        cout
<<endl;
        
return;
    }


    
for(temp[index] = 0; temp[index] < count[num[index]]; temp[index]++)
    
{
        display2(num, temp, index 
+ 1, counts);
    }

}
;

void main()
{
    
int z[4= {2345};
    
int j;
    Display1(z, 
4);
    cin
>>j;
    
int temp[10= {0};
    display2(z, temp, 
04);
    cin
>>j;
}
posted on 2009-07-05 00:42  Jackill  阅读(282)  评论(0编辑  收藏  举报