// 3_2.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" char c[10][10]= { "", "", "abc", "def", "jkl", "mno", "pqrs", "tuv", "wxyz", }; int total[10] = {0,0,3,3,3,3,3,4,3,4}; int number[4] = {3,2,3,4}; int answer[4] = {0}; void recursive(int * number, int * answer, int index, int n) { if(index == n) { for(int i=0;i<n;i++) printf("%c", c[number[i]][answer[i]]); printf("\n"); return; } for(answer[index]=0;answer[index]<total[number[index]];answer[index]++) { recursive(number, answer, index+1, n); } } int _tmain(int argc, _TCHAR* argv[]) { recursive(number, answer, 0, 4); return 0; }