📄 字符串递规问题.cpp
字号:
// 字符串递规问题.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<stdlib.h>
#include<iostream.h>
#include<string.h>
#define SIZE 10 /*临时数组的大小,其值一定要大于N */
void Full(char *p,int n,char *s,int m)
{
if (n==0)
{
s[m]='\0';
cout<<s<<" ";
}
else
for (int i=0;i < strlen(p);i++)
{
s[m]=p[i];
Full(p,n-1,s,m+1); //函数的递归调用
}
}
void main()
{
char s[SIZE];
char *p="abc";
int m=6;
Full("abc",m,s,0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -